Socket
Socket
Sign inDemoInstall

x-path

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "x-path",
"description": "An extention for native node path module.",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/node-x-extras/x-path",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/node-x-extras/x-path/issues",

@@ -34,21 +34,11 @@ /*

path.isDirectory = function(filePath, cb) {
function statAsync(isType, filePath, cb) {
fs.stat(filePath, function (err, stat) {
var exists;
err = err && ['ENOENT', 'ENOTDIR'].indexOf(err.code) < 0 ? err : null;
if (!err) { exists = stat ? stat.isDirectory() : false; }
if (!err) { exists = stat ? stat[isType]() : false; }
cb(err, exists);
});
};
path.isFile = function(filePath, cb) {
fs.stat(filePath, function (err, stat) {
var exists;
err = err && ['ENOENT', 'ENOTDIR'].indexOf(err.code) < 0 ? err : null;
if (!err) { exists = stat ? stat.isFile() : false; }
cb(err, exists);
});
};
path.isDirectorySync = function(filePath) {
}
function statSync(isType, filePath, cb) {
var stat;

@@ -61,16 +51,18 @@ try {

}
return stat.isDirectory();
};
return stat[isType]();
}
path.isFileSync = function(filePath) {
var stat;
try {
stat = fs.statSync(filePath);
} catch (e) {
if (['ENOENT', 'ENOTDIR'].indexOf(e.code) < 0) { throw e; }
return false;
}
return stat.isFile();
path.isDirectory = function(filePath, cb) {
return statAsync('isDirectory', filePath, cb)
};
path.isFile = function(filePath, cb) {
return statAsync('isFile', filePath, cb)
};
path.isDirectorySync = function(filePath, cb) {
return statSync('isDirectory', filePath, cb)
};
path.isFileSync = function(filePath, cb) {
return statSync('isFile', filePath, cb)
};
module.exports = path;
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc