Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

path-type

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-type - npm Package Compare versions

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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc