[Pkg-javascript-commits] [node-os-homedir] 01/04: Import Upstream version 1.0.2
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Tue Oct 18 13:23:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository node-os-homedir.
commit 0c68ee22fe47c8b0fe1bf39fc2c1a372b75e9d66
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Tue Oct 18 18:29:46 2016 +0530
Import Upstream version 1.0.2
---
.editorconfig | 12 ++++++++++++
.gitattributes | 2 ++
.gitignore | 1 +
.travis.yml | 7 +++++++
index.js | 24 ++++++++++++++++++++++++
license | 21 +++++++++++++++++++++
package.json | 41 +++++++++++++++++++++++++++++++++++++++++
readme.md | 31 +++++++++++++++++++++++++++++++
test.js | 9 +++++++++
9 files changed, 148 insertions(+)
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..98a761d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..391f0a4
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+* text=auto
+*.js text eol=lf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2c6e9b0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+sudo: false
+language: node_js
+node_js:
+ - '6'
+ - '4'
+ - '0.12'
+ - '0.10'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..3306616
--- /dev/null
+++ b/index.js
@@ -0,0 +1,24 @@
+'use strict';
+var os = require('os');
+
+function homedir() {
+ var env = process.env;
+ var home = env.HOME;
+ var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
+
+ if (process.platform === 'win32') {
+ return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
+ }
+
+ if (process.platform === 'darwin') {
+ return home || (user ? '/Users/' + user : null);
+ }
+
+ if (process.platform === 'linux') {
+ return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null));
+ }
+
+ return home || null;
+}
+
+module.exports = typeof os.homedir === 'function' ? os.homedir : homedir;
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..525b225
--- /dev/null
+++ b/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "os-homedir",
+ "version": "1.0.2",
+ "description": "Node.js 4 `os.homedir()` ponyfill",
+ "license": "MIT",
+ "repository": "sindresorhus/os-homedir",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus at gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "builtin",
+ "core",
+ "ponyfill",
+ "polyfill",
+ "shim",
+ "os",
+ "homedir",
+ "home",
+ "dir",
+ "directory",
+ "folder",
+ "user",
+ "path"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "path-exists": "^2.0.0",
+ "xo": "^0.16.0"
+ }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..856ae61
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,31 @@
+# os-homedir [](https://travis-ci.org/sindresorhus/os-homedir)
+
+> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com)
+
+
+## Install
+
+```
+$ npm install --save os-homedir
+```
+
+
+## Usage
+
+```js
+const osHomedir = require('os-homedir');
+
+console.log(osHomedir());
+//=> '/Users/sindresorhus'
+```
+
+
+## Related
+
+- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result
+- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..3090c58
--- /dev/null
+++ b/test.js
@@ -0,0 +1,9 @@
+import test from 'ava';
+import pathExists from 'path-exists';
+import m from './';
+
+test(t => {
+ const homeDir = m();
+ t.true(homeDir.length > 0);
+ t.true(pathExists.sync(homeDir));
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-os-homedir.git
More information about the Pkg-javascript-commits
mailing list