[Pkg-javascript-commits] [node-path-type] 01/04: New upstream version 3.0.0

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Fri Feb 9 06:54:11 UTC 2018


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-path-type.

commit ec82ea11c0ea80b4031bb78622afdd2fefe9a202
Author: Pirate Praveen <praveen at debian.org>
Date:   Fri Feb 9 11:50:53 2018 +0530

    New upstream version 3.0.0
---
 .editorconfig |  2 +-
 .gitignore    |  1 +
 .npmrc        |  1 +
 .travis.yml   |  1 +
 index.js      | 20 ++++++++++++--
 license       | 20 +++-----------
 package.json  | 89 +++++++++++++++++++++++++++++------------------------------
 readme.md     |  2 +-
 test.js       | 10 ++++++-
 9 files changed, 79 insertions(+), 67 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index 98a761d..1c6314a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,6 +7,6 @@ charset = utf-8
 trim_trailing_whitespace = true
 insert_final_newline = true
 
-[{package.json,*.yml}]
+[*.yml]
 indent_style = space
 indent_size = 2
diff --git a/.gitignore b/.gitignore
index 3c3629e..239ecff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 node_modules
+yarn.lock
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000..43c97e7
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+package-lock=false
diff --git a/.travis.yml b/.travis.yml
index 97519af..7d69d74 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
 language: node_js
 node_js:
+  - '8'
   - '6'
   - '4'
diff --git a/index.js b/index.js
index 4ac9dd9..6e0a1b7 100644
--- a/index.js
+++ b/index.js
@@ -7,7 +7,15 @@ function type(fn, fn2, fp) {
 		return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
 	}
 
-	return pify(fs[fn])(fp).then(stats => stats[fn2]());
+	return pify(fs[fn])(fp)
+		.then(stats => stats[fn2]())
+		.catch(err => {
+			if (err.code === 'ENOENT') {
+				return false;
+			}
+
+			throw err;
+		});
 }
 
 function typeSync(fn, fn2, fp) {
@@ -15,7 +23,15 @@ function typeSync(fn, fn2, fp) {
 		throw new TypeError(`Expected a string, got ${typeof fp}`);
 	}
 
-	return fs[fn](fp)[fn2]();
+	try {
+		return fs[fn](fp)[fn2]();
+	} catch (err) {
+		if (err.code === 'ENOENT') {
+			return false;
+		}
+
+		throw err;
+	}
 }
 
 exports.file = type.bind(null, 'stat', 'isFile');
diff --git a/license b/license
index 654d0bf..e7af2f7 100644
--- a/license
+++ b/license
@@ -1,21 +1,9 @@
-The MIT License (MIT)
+MIT License
 
 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:
+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 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.
+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
index 54336f3..bdcb46e 100644
--- a/package.json
+++ b/package.json
@@ -1,48 +1,45 @@
 {
-  "name": "path-type",
-  "version": "2.0.0",
-  "description": "Check if a path is a file, directory, or symlink",
-  "license": "MIT",
-  "repository": "sindresorhus/path-type",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus at gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "engines": {
-    "node": ">=4"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "files": [
-    "index.js"
-  ],
-  "keywords": [
-    "path",
-    "fs",
-    "type",
-    "is",
-    "check",
-    "directory",
-    "dir",
-    "file",
-    "filepath",
-    "symlink",
-    "symbolic",
-    "link",
-    "stat",
-    "stats",
-    "filesystem"
-  ],
-  "dependencies": {
-    "pify": "^2.0.0"
-  },
-  "devDependencies": {
-    "ava": "*",
-    "xo": "*"
-  },
-  "xo": {
-    "esnext": true
-  }
+	"name": "path-type",
+	"version": "3.0.0",
+	"description": "Check if a path is a file, directory, or symlink",
+	"license": "MIT",
+	"repository": "sindresorhus/path-type",
+	"author": {
+		"name": "Sindre Sorhus",
+		"email": "sindresorhus at gmail.com",
+		"url": "sindresorhus.com"
+	},
+	"engines": {
+		"node": ">=4"
+	},
+	"scripts": {
+		"test": "xo && ava"
+	},
+	"files": [
+		"index.js"
+	],
+	"keywords": [
+		"path",
+		"fs",
+		"type",
+		"is",
+		"check",
+		"directory",
+		"dir",
+		"file",
+		"filepath",
+		"symlink",
+		"symbolic",
+		"link",
+		"stat",
+		"stats",
+		"filesystem"
+	],
+	"dependencies": {
+		"pify": "^3.0.0"
+	},
+	"devDependencies": {
+		"ava": "*",
+		"xo": "*"
+	}
 }
diff --git a/readme.md b/readme.md
index b1ea61f..ed2af8b 100644
--- a/readme.md
+++ b/readme.md
@@ -6,7 +6,7 @@
 ## Install
 
 ```
-$ npm install --save path-type
+$ npm install path-type
 ```
 
 
diff --git a/test.js b/test.js
index 75f07a5..1d4dd89 100644
--- a/test.js
+++ b/test.js
@@ -1,5 +1,5 @@
 import test from 'ava';
-import m from './';
+import m from '.';
 
 test('.file()', async t => {
 	t.true(await m.file('package.json'));
@@ -24,3 +24,11 @@ test('.dirSync()', t => {
 test('.symlinkSync()', t => {
 	t.true(m.symlinkSync('symlink'));
 });
+
+test('return false if path doesn\'t exist - async', async t => {
+	t.false(await m.file('unicorn'));
+});
+
+test('return false if path doesn\'t exist - sync', t => {
+	t.false(m.fileSync('unicorn'));
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-path-type.git



More information about the Pkg-javascript-commits mailing list