Comparing version 1.1.0 to 2.0.0
13
index.js
'use strict'; | ||
var fs = require('graceful-fs'); | ||
var Promise = require('pinkie-promise'); | ||
var pify = require('pify'); | ||
const fs = require('fs'); | ||
const pify = require('pify'); | ||
function type(fn, fn2, fp) { | ||
if (typeof fp !== 'string') { | ||
return Promise.reject(new TypeError('Expected a string')); | ||
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`)); | ||
} | ||
return pify(fs[fn], Promise)(fp).then(function (stats) { | ||
return stats[fn2](); | ||
}); | ||
return pify(fs[fn])(fp).then(stats => stats[fn2]()); | ||
} | ||
@@ -18,3 +15,3 @@ | ||
if (typeof fp !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
throw new TypeError(`Expected a string, got ${typeof fp}`); | ||
} | ||
@@ -21,0 +18,0 @@ |
{ | ||
"name": "path-type", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Check if a path is a file, directory, or symlink", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
@@ -40,5 +40,3 @@ "scripts": { | ||
"dependencies": { | ||
"graceful-fs": "^4.1.2", | ||
"pify": "^2.0.0", | ||
"pinkie-promise": "^2.0.0" | ||
"pify": "^2.0.0" | ||
}, | ||
@@ -50,6 +48,4 @@ "devDependencies": { | ||
"xo": { | ||
"ignores": [ | ||
"test.js" | ||
] | ||
"esnext": true | ||
} | ||
} |
@@ -16,5 +16,5 @@ # path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type) | ||
```js | ||
var pathType = require('path-type'); | ||
const pathType = require('path-type'); | ||
pathType.file('package.json').then(function (isFile) { | ||
pathType.file('package.json').then(isFile => { | ||
console.log(isFile); | ||
@@ -32,3 +32,3 @@ //=> true | ||
Returns a promise that resolves to a boolean of whether the path is the checked type. | ||
Returns a `Promise` for a `boolean` of whether the path is the checked type. | ||
@@ -39,3 +39,3 @@ ### .fileSync(path) | ||
Returns a boolean of whether the path is the checked type. | ||
Returns a `boolean` of whether the path is the checked type. | ||
@@ -45,2 +45,2 @@ | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
3402
21
2
- Removedgraceful-fs@^4.1.2
- Removedpinkie-promise@^2.0.0
- Removedgraceful-fs@4.2.11(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)