Socket
Socket
Sign inDemoInstall

next

Package Overview
Dependencies
2
Maintainers
1
Versions
2641
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.5 to 0.2.6

.travis.yml

2

lib/child_process/index.js
'use strict';
module.exports = {
pipe: require('./pipe')
pipe: require('./pipe')
};

@@ -8,2 +8,3 @@ // For given path returns root package path.

, path = require('path')
, contains = require('es5-ext/lib/Array/prototype/contains')

@@ -16,21 +17,30 @@ , dirExists = require('./fs/dir-exists')

, isPackageRoot;
, isPackageRoot, cache = [];
isPackageRoot = function (pckgpath, callback) {
fileExists(pckgpath + '/package.json', function (exists) {
cache.contains = contains;
isPackageRoot = function (path, callback) {
if (cache.contains(path)) {
callback(null, path);
return;
}
fileExists(path + '/package.json', function (exists) {
if (exists) {
callback(null, pckgpath);
cache.push(path);
callback(null, path);
return;
}
dirExists(pckgpath + '/node_modules', function (exists) {
dirExists(path + '/node_modules', function (exists) {
var parentpath;
if (exists) {
callback(null, pckgpath);
cache.push(path);
callback(null, path);
} else {
parentpath = dirname(pckgpath);
if (parentpath === pckgpath) {
parentpath = dirname(path);
if (parentpath === path) {
callback(null, null);
} else if (parentpath.slice(parentpath.lastIndexOf('/') + 1)
=== 'node_modules') {
callback(null, pckgpath);
cache.push(path);
callback(null, path);
} else {

@@ -44,15 +54,15 @@ isPackageRoot(parentpath, callback);

module.exports = function find (pckgpath, callback) {
pckgpath = normalize(pckgpath);
stat(pckgpath, function (err, stats) {
module.exports = function find (path, callback) {
path = normalize(path);
stat(path, function (err, stats) {
if (err) {
find(dirname(pckgpath), callback);
find(dirname(path), callback);
return;
}
if (stats.isDirectory()) {
isPackageRoot(ptrim(pckgpath), callback);
isPackageRoot(ptrim(path), callback);
} else {
isPackageRoot(dirname(pckgpath), callback);
isPackageRoot(dirname(path), callback);
}
});
};

@@ -10,3 +10,3 @@ // Copy file

module.exports = function (source, dest, cb){
fs.stat(source, function (err, stats) {
fs.lstat(source, function (err, stats) {
var read;

@@ -13,0 +13,0 @@ if (err) {

@@ -8,5 +8,5 @@ // Whether given path points existing directory

module.exports = function (path, callback) {
fs.stat(path, function (err, stats) {
fs.lstat(path, function (err, stats) {
callback(err ? false : stats.isDirectory());
});
};

@@ -8,5 +8,5 @@ // Whether given path points existing file

module.exports = function (path, callback) {
fs.stat(path, function (err, stats) {
fs.lstat(path, function (err, stats) {
callback(err ? false : stats.isFile());
});
};
'use strict';
module.exports = {
copy: require('./copy'),
copySync: require('./copy-sync'),
dirExists: require('./dir-exists'),
fileExists: require('./file-exists'),
readdirFilesDeep: require('./readdir-files-deep')
copy: require('./copy'),
copySync: require('./copy-sync'),
dirExists: require('./dir-exists'),
fileExists: require('./file-exists'),
filesAtPath: require('./files-at-path'),
readdirDirectories: require('./readdir-directories'),
readdirFilesDeep: require('./readdir-files-deep')
};

@@ -5,20 +5,22 @@ // Read all filenames from directory and it's subdirectories

var fs = require('fs')
, aritize = require('es5-ext/lib/Function/aritize').call
, curry = require('es5-ext/lib/Function/curry').call
var call = Function.prototype.call
, fs = require('fs')
, aritize = require('es5-ext/lib/Function/prototype/aritize')
, invoke = require('es5-ext/lib/Function/invoke')
, flatten = require('es5-ext/lib/List/flatten').call
, a2p = require('deferred/lib/async-to-promise').call
, all = require('deferred/lib/join/all')
, concat = aritize(String.prototype.concat, 1)
, k = require('es5-ext/lib/Function/k')
, flatten = call.bind(require('es5-ext/lib/Array/prototype/flatten'))
, deferred = require('deferred')
, concat = aritize.call(String.prototype.concat, 1)
, trim = require('../path/trim');
, trim = require('../path/trim')
module.exports = function readdir (path, callback) {
path = trim(path);
a2p(fs.readdir, path)
, readdir = deferred.promisify(fs.readdir)
, stat = deferred.promisify(fs.lstat);
module.exports = function self (path, callback) {
readdir(path = trim(path))
(function (files) {
return all(files.map(function (file) {
return deferred.map(files, function (file) {
var npath = path + '/' + file;
return a2p(fs.stat, npath)
return stat(npath)
(function (stats) {

@@ -28,3 +30,3 @@ if (stats.isFile()) {

} else if (stats.isDirectory()) {
return a2p(readdir, npath)
return deferred.promisify(self)(npath)
(invoke('map', concat, file + '/'));

@@ -34,8 +36,7 @@ } else {

}
});
}))
}, file);
})
(invoke('filter', Boolean))
(flatten)
(curry(callback, null));
(flatten);
}).end(callback);
};
'use strict';
module.exports = {
relative: require('./relative'),
trim: require('./trim')
endWithSlash: require('./end-with-slash'),
relative: require('./relative'),
trim: require('./trim')
};

@@ -6,7 +6,6 @@ // Require module, if module is not found return null, if there was an error

var bbind = require('es5-ext/lib/Function/bind-bind')
, isNotFound = require('./is-module-not-found-error')
, startsWith = require('es5-ext/lib/String/starts-with');
var bind = Function.prototype.bind
, isNotFound = require('./is-module-not-found-error');
module.exports = bbind(function (path) {
module.exports = bind.bind(function (path) {
try {

@@ -13,0 +12,0 @@ return this.apply(null, arguments);

{
"name": "next",
"version": "0.2.5",
"version": "0.2.6",
"description": "Node.js extensions",
"keywords": ["node", "nodejs", "node.js", "extensions", "addons", "extras"],
"author": "Mariusz Nowak <medikoo+node-ext@medikoo.com> (http://www.medikoo.com/)",
"author":
"Mariusz Nowak <medikoo+node-ext@medikoo.com> (http://www.medikoo.com/)",
"main": "lib/index",

@@ -20,6 +21,8 @@ "repository": {

"dependencies": {
"es5-ext": "0.6.x",
"deferred": "0.2.x"
"es5-ext": "0.7.x",
"deferred": "0.4.x"
},
"scripts": { "test": "./node_modules/tad/bin/tad lib" },
"scripts": {
"test": "node ./node_modules/tad/bin/tad lib"
},
"devDependencies": {

@@ -26,0 +29,0 @@ "tad": "0.1.x"

# node-ext - Node.js extensions
Functions that complements Node.js API.
Functions that complement Node.js API.
_It's work in progress, new methods are added when needed._

@@ -5,0 +5,0 @@

@@ -14,4 +14,4 @@ 'use strict';

}
a.deepEqual(files, ['four', 'one/one/one', 'two/one']); d();
a.deepEqual(files.sort(), ['four', 'one/one/one', 'two/one'].sort()); d();
});
};
'use strict';
module.exports = {
"With ending slash": function (t, a) {
a.equal(t('raz/dwa/'), 'raz/dwa');
},
"Without ending slash": function (t, a) {
a.equal(t('/raz/dwa'), '/raz/dwa');
},
"Empty": function (t, a) {
a.equal(t(''), '');
},
"Root": function (t, a) {
a.equal(t('/'), '/');
}
module.exports = function (t, a) {
a(t('raz/dwa/'), 'raz/dwa', "With ending slash");
a(t('/raz/dwa'), '/raz/dwa', "Without ending slash");
a(t(''), '', "Empty");
a(t('/'), '/', "Root");
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc