Comparing version 1.16.2 to 1.16.3
@@ -110,2 +110,3 @@ // Generated by CoffeeScript 1.4.0 | ||
balUtilPaths.readPath(local, function(err, data) { | ||
var dataStr; | ||
if (err) { | ||
@@ -115,3 +116,4 @@ return typeof errorCallback === "function" ? errorCallback(err, data) : void 0; | ||
try { | ||
details.local = JSON.parse(data.toString()); | ||
dataStr = data.toString(); | ||
details.local = JSON.parse(dataStr); | ||
} catch (err) { | ||
@@ -125,3 +127,4 @@ return typeof errorCallback === "function" ? errorCallback(err, data) : void 0; | ||
try { | ||
details.remote = JSON.parse(data.toString()); | ||
dataStr = data.toString(); | ||
details.remote = JSON.parse(dataStr); | ||
} catch (err) { | ||
@@ -128,0 +131,0 @@ return typeof errorCallback === "function" ? errorCallback(err, data) : void 0; |
@@ -182,5 +182,2 @@ // Generated by CoffeeScript 1.4.0 | ||
var event; | ||
if (debug) { | ||
console.log("onceUnlocked " + eventName); | ||
} | ||
event = this.event(eventName); | ||
@@ -187,0 +184,0 @@ if (event.locked) { |
@@ -50,2 +50,14 @@ // Generated by CoffeeScript 1.4.0 | ||
}, | ||
clone: function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
args.unshift({}); | ||
return this.shallowExtendPlainObjects.apply(this, args); | ||
}, | ||
deepClone: function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
args.unshift({}); | ||
return this.deepExtendPlainObjects.apply(this, args); | ||
}, | ||
extend: function() { | ||
@@ -237,13 +249,26 @@ var args; | ||
if (keys.length === 0) { | ||
return null; | ||
return void 0; | ||
} | ||
key = keys[0]; | ||
if (location != null) { | ||
if (keys.length === 0 || typeof location === 'undefined') { | ||
result = void 0; | ||
} else if (location === null) { | ||
result = null; | ||
} else { | ||
key = keys[0]; | ||
location = (_ref = location.attributes) != null ? _ref : location; | ||
if (keys.length === 1) { | ||
if (safe) { | ||
result = (_ref1 = location[key]) != null ? _ref1 : location[key] = value; | ||
if ((_ref1 = location[key]) == null) { | ||
location[key] = value; | ||
} | ||
} else { | ||
result = location[key] = value; | ||
if (typeof value === 'undefined') { | ||
if (typeof location[key] !== 'undefined') { | ||
delete location[key]; | ||
} | ||
} else { | ||
location[key] = value; | ||
} | ||
} | ||
result = location[key]; | ||
} else { | ||
@@ -253,4 +278,2 @@ location = (_ref2 = location[key]) != null ? _ref2 : location[key] = {}; | ||
} | ||
} else { | ||
result = null; | ||
} | ||
@@ -260,13 +283,14 @@ return result; | ||
getDeep: function(location, keys) { | ||
var key, result, _ref, _ref1; | ||
var key, result, _ref; | ||
if (!balUtilTypes.isArray(keys)) { | ||
keys = keys.split('.'); | ||
} | ||
if (keys.length === 0) { | ||
return null; | ||
} | ||
key = keys[0]; | ||
if (location != null) { | ||
if (keys.length === 0 || typeof location === 'undefined') { | ||
result = void 0; | ||
} else if (location === null) { | ||
result = null; | ||
} else { | ||
key = keys[0]; | ||
location = (_ref = location.attributes) != null ? _ref : location; | ||
location = (_ref1 = location[key]) != null ? _ref1 : null; | ||
location = typeof location[key] === 'undefined' ? void 0 : location[key]; | ||
if (keys.length === 1) { | ||
@@ -277,4 +301,2 @@ result = location; | ||
} | ||
} else { | ||
result = null; | ||
} | ||
@@ -281,0 +303,0 @@ return result; |
@@ -196,3 +196,5 @@ // Generated by CoffeeScript 1.4.0 | ||
} | ||
return balUtilModules.spawn([possibleExecPath, '--version'], function(err, stdout, stderr, code, signal) { | ||
return balUtilModules.spawn([possibleExecPath, '--version'], { | ||
env: process.env | ||
}, function(err, stdout, stderr, code, signal) { | ||
if (err) { | ||
@@ -221,4 +223,8 @@ return complete(); | ||
getStandardExecPaths: function(execName) { | ||
var possibleExecPaths; | ||
var index, possibleExecPaths, value, _i, _len; | ||
possibleExecPaths = [process.cwd()].concat(balUtilModules.getEnvironmentPaths()); | ||
for (index = _i = 0, _len = possibleExecPaths.length; _i < _len; index = ++_i) { | ||
value = possibleExecPaths[index]; | ||
possibleExecPaths[index] = value.replace(/\/$/, ''); | ||
} | ||
if (execName) { | ||
@@ -225,0 +231,0 @@ possibleExecPaths = balUtilFlow.suffixArray("/" + execName, possibleExecPaths); |
@@ -241,9 +241,5 @@ // Generated by CoffeeScript 1.4.0 | ||
if (err) { | ||
console.log("balUtilPaths.cp: cp failed on: " + src); | ||
return next(err); | ||
} | ||
return balUtilPaths.writeFile(dst, data, 'binary', function(err) { | ||
if (err) { | ||
console.log("balUtilPaths.cp: writeFile failed on: " + dst); | ||
} | ||
return next(err); | ||
@@ -269,3 +265,2 @@ }); | ||
if (err) { | ||
console.log("balUtilPaths.ensurePath: failed to ensure the path: " + parentPath); | ||
return next(err, false); | ||
@@ -276,4 +271,4 @@ } | ||
if (!exists) { | ||
console.log("balUtilPaths.ensurePath: failed to create the directory: " + path); | ||
return next(new Error("Failed to create the directory: " + path)); | ||
err = new Error("Failed to create the directory: " + path); | ||
return next(err, false); | ||
} | ||
@@ -300,3 +295,2 @@ return next(null, false); | ||
if (err) { | ||
console.log("balUtilPaths.isDirectory: stat failed on: " + path); | ||
return next(err); | ||
@@ -439,3 +433,2 @@ } | ||
} else if (err) { | ||
console.log('balUtilPaths.scandir: readdir has failed on:', opts.path); | ||
return tasks.exit(err); | ||
@@ -465,3 +458,2 @@ } | ||
} else if (err) { | ||
console.log('balUtilPaths.scandir: isDirectory has failed on:', fileFullPath); | ||
return tasks.exit(err); | ||
@@ -505,3 +497,2 @@ } else if (isDirectory) { | ||
} else if (err) { | ||
console.log('balUtilPaths.scandir: has failed on:', fileFullPath); | ||
return tasks.exit(err); | ||
@@ -571,9 +562,14 @@ } else if (subtreeCallback) { | ||
cpdir: function() { | ||
var args, err, next, opt, opts, outPath, scandirOpts, srcPath, _i, _len, _ref6, _ref7; | ||
var args, err, next, opt, opts, outPath, scandirOpts, srcPath, _i, _len, _ref6; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
opts = {}; | ||
if (args.length === 1) { | ||
_ref6 = opts = args[0], srcPath = _ref6.srcPath, outPath = _ref6.outPath, next = _ref6.next; | ||
opts = args[0]; | ||
} else if (args.length >= 3) { | ||
srcPath = args[0], outPath = args[1], next = args[2]; | ||
opts = { | ||
srcPath: srcPath, | ||
outPath: outPath, | ||
next: next | ||
}; | ||
} else { | ||
@@ -588,15 +584,11 @@ err = new Error('balUtilPaths.cpdir: unknown arguments'); | ||
scandirOpts = { | ||
path: srcPath, | ||
path: opts.srcPath, | ||
fileAction: function(fileSrcPath, fileRelativePath, next) { | ||
var fileOutPath; | ||
fileOutPath = pathUtil.join(outPath, fileRelativePath); | ||
fileOutPath = pathUtil.join(opts.outPath, fileRelativePath); | ||
return balUtilPaths.ensurePath(pathUtil.dirname(fileOutPath), function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.cpdir: failed to create the path for the file:', fileSrcPath); | ||
return next(err); | ||
} | ||
return balUtilPaths.cp(fileSrcPath, fileOutPath, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.cpdir: failed to copy the child file:', fileSrcPath); | ||
} | ||
return next(err); | ||
@@ -606,7 +598,7 @@ }); | ||
}, | ||
next: next | ||
next: opts.next | ||
}; | ||
_ref7 = ['ignorePaths', 'ignoreHiddenFiles', 'ignoreCommonPatterns', 'ignoreCustomPatterns']; | ||
for (_i = 0, _len = _ref7.length; _i < _len; _i++) { | ||
opt = _ref7[_i]; | ||
_ref6 = ['ignorePaths', 'ignoreHiddenFiles', 'ignoreCommonPatterns', 'ignoreCustomPatterns']; | ||
for (_i = 0, _len = _ref6.length; _i < _len; _i++) { | ||
opt = _ref6[_i]; | ||
scandirOpts[opt] = opts[opt]; | ||
@@ -618,9 +610,14 @@ } | ||
rpdir: function() { | ||
var args, err, next, opt, opts, outPath, scandirOpts, srcPath, _i, _len, _ref6, _ref7; | ||
var args, err, next, opt, opts, outPath, scandirOpts, srcPath, _i, _len, _ref6; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
opts = {}; | ||
if (args.length === 1) { | ||
_ref6 = opts = args[0], srcPath = _ref6.srcPath, outPath = _ref6.outPath, next = _ref6.next; | ||
opts = args[0]; | ||
} else if (args.length >= 3) { | ||
srcPath = args[0], outPath = args[1], next = args[2]; | ||
opts = { | ||
srcPath: srcPath, | ||
outPath: outPath, | ||
next: next | ||
}; | ||
} else { | ||
@@ -635,9 +632,8 @@ err = new Error('balUtilPaths.cpdir: unknown arguments'); | ||
scandirOpts = { | ||
path: srcPath, | ||
path: opts.srcPath, | ||
fileAction: function(fileSrcPath, fileRelativePath, next) { | ||
var fileOutPath; | ||
fileOutPath = pathUtil.join(outPath, fileRelativePath); | ||
fileOutPath = pathUtil.join(opts.outPath, fileRelativePath); | ||
return balUtilPaths.ensurePath(pathUtil.dirname(fileOutPath), function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.rpdir: failed to create the path for the file:', fileSrcPath); | ||
return next(err); | ||
@@ -648,5 +644,2 @@ } | ||
return balUtilPaths.cp(fileSrcPath, fileOutPath, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.rpdir: failed to copy the child file:', fileSrcPath); | ||
} | ||
return next(err); | ||
@@ -660,7 +653,7 @@ }); | ||
}, | ||
next: next | ||
next: opts.next | ||
}; | ||
_ref7 = ['ignorePaths', 'ignoreHiddenFiles', 'ignoreCommonPatterns', 'ignoreCustomPatterns']; | ||
for (_i = 0, _len = _ref7.length; _i < _len; _i++) { | ||
opt = _ref7[_i]; | ||
_ref6 = ['ignorePaths', 'ignoreHiddenFiles', 'ignoreCommonPatterns', 'ignoreCustomPatterns']; | ||
for (_i = 0, _len = _ref6.length; _i < _len; _i++) { | ||
opt = _ref6[_i]; | ||
scandirOpts[opt] = opts[opt]; | ||
@@ -678,5 +671,2 @@ } | ||
return balUtilPaths.unlink(fileFullPath, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.rmdirDeep: failed to remove the child file:', fileFullPath); | ||
} | ||
return next(err); | ||
@@ -687,5 +677,2 @@ }); | ||
return balUtilPaths.rmdirDeep(fileFullPath, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.rmdirDeep: failed to remove the child directory:', fileFullPath); | ||
} | ||
return next(err); | ||
@@ -699,5 +686,2 @@ }); | ||
return balUtilPaths.rmdir(parentPath, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.rmdirDeep: failed to remove the parent directory:', parentPath); | ||
} | ||
return next(err, list, tree); | ||
@@ -728,5 +712,2 @@ }); | ||
balUtilPaths.writeFile(fileFullPath, value, function(err) { | ||
if (err) { | ||
console.log('balUtilPaths.writetree: writeFile failed on:', fileFullPath); | ||
} | ||
return tasks.complete(err); | ||
@@ -743,3 +724,3 @@ }); | ||
readPath: function(filePath, opts, next) { | ||
var http, req, requestOpts, _ref6, _ref7; | ||
var http, req, requestOpts, _ref6, _ref7, _ref8; | ||
_ref6 = balUtilFlow.extractOptsAndCallback(opts, next), opts = _ref6[0], next = _ref6[1]; | ||
@@ -765,2 +746,10 @@ if (/^http/.test(filePath)) { | ||
}); | ||
if ((_ref7 = req.setTimeout) == null) { | ||
req.setTimeout = function(delay) { | ||
return setTimeout((function() { | ||
req.abort(); | ||
return next(new Error('Request timed out')); | ||
}), delay); | ||
}; | ||
} | ||
req.on('error', function(err) { | ||
@@ -770,3 +759,3 @@ return next(err); | ||
return req.abort(); | ||
}).setTimeout((_ref7 = opts.timeout) != null ? _ref7 : 10 * 1000); | ||
}).setTimeout((_ref8 = opts.timeout) != null ? _ref8 : 10 * 1000); | ||
} else { | ||
@@ -773,0 +762,0 @@ balUtilPaths.readFile(filePath, function(err, data) { |
@@ -80,7 +80,9 @@ // Generated by CoffeeScript 1.4.0 | ||
empty = true; | ||
for (key in value) { | ||
if (!__hasProp.call(value, key)) continue; | ||
value = value[key]; | ||
empty = false; | ||
break; | ||
if (value != null) { | ||
for (key in value) { | ||
if (!__hasProp.call(value, key)) continue; | ||
value = value[key]; | ||
empty = false; | ||
break; | ||
} | ||
} | ||
@@ -87,0 +89,0 @@ return empty; |
{ | ||
"name": "bal-util", | ||
"version": "1.16.2", | ||
"version": "1.16.3", | ||
"description": "Common utility functions for Node.js used and maintained by Benjamin Lupton", | ||
@@ -43,3 +43,3 @@ "homepage": "https://github.com/balupton/bal-util", | ||
"engines" : { | ||
"node": ">=0.6" | ||
"node": ">=0.4" | ||
}, | ||
@@ -55,5 +55,5 @@ "dependencies": {}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/cake test" | ||
"test": "node ./out/test/everything.test.js --joe-reporter=list" | ||
}, | ||
"main": "./out/lib/balutil" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
2652
93308
40