Comparing version 1.14.1 to 1.15.0
## History | ||
- v1.15.0 December 15, 2012 | ||
- `balUtilPaths` changes: | ||
- Added `testIgnorePatterns` | ||
- Renamed `ignorePatterns` to `ignoreCommonPatterns`, and added new `ignoreCustomPatterns` | ||
- Affects `scandir` options | ||
- Added emac cache files to `ignoreCommonPatterns` | ||
- v1.14.1 December 14, 2012 | ||
@@ -4,0 +11,0 @@ - `balUtilModules` changes: |
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var balUtilFlow, balUtilPaths, balUtilTypes, fsUtil, pathUtil, _ref, _ref1, _ref2, _ref3, | ||
var balUtilFlow, balUtilPaths, balUtilTypes, fsUtil, pathUtil, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, | ||
@@ -29,2 +29,6 @@ __slice = [].slice, | ||
balUtilPaths = { | ||
ignoreCommonPatterns: (_ref4 = process.env.NODE_IGNORE_COMMON_PATTERNS) != null ? _ref4 : /^((~|\.\#).*|.*(\.swp)|\.(svn|git|hg|DS_Store)|node_modules|CVS|thumbs\.db|desktop\.ini)$/i, | ||
ignoreCustomPatterns: (_ref5 = process.env.NODE_IGNORE_CUSTOM_PATTERNS) != null ? _ref5 : null, | ||
textExtensions: ['c', 'coffee', 'coffeekup', 'cson', 'css', 'eco', 'haml', 'hbs', 'htaccess', 'htm', 'html', 'jade', 'js', 'json', 'less', 'md', 'php', 'phtml', 'py', 'rb', 'rtf', 'sass', 'scss', 'styl', 'stylus', 'text', 'txt', 'xml', 'yaml'].concat((process.env.TEXT_EXTENSIONS || '').split(/[\s,]+/)), | ||
binaryExtensions: ['dds', 'eot', 'gif', 'ico', 'jar', 'jpeg', 'jpg', 'pdf', 'png', 'swf', 'tga', 'ttf', 'zip'].concat((process.env.BINARY_EXTENSIONS || '').split(/[\s,]+/)), | ||
openFile: function(next) { | ||
@@ -148,4 +152,2 @@ if (global.numberOfOpenFiles < 0) { | ||
}, | ||
textExtensions: ['c', 'coffee', 'coffeekup', 'cson', 'css', 'eco', 'haml', 'hbs', 'htaccess', 'htm', 'html', 'jade', 'js', 'json', 'less', 'md', 'php', 'phtml', 'py', 'rb', 'rtf', 'sass', 'scss', 'styl', 'stylus', 'text', 'txt', 'xml', 'yaml'].concat((process.env.TEXT_EXTENSIONS || '').split(/[\s,]+/)), | ||
binaryExtensions: ['dds', 'eot', 'gif', 'ico', 'jar', 'jpeg', 'jpg', 'pdf', 'png', 'swf', 'tga', 'ttf', 'zip'].concat((process.env.BINARY_EXTENSIONS || '').split(/[\s,]+/)), | ||
isTextSync: function(filename, buffer) { | ||
@@ -184,3 +186,3 @@ var extension, isText, _i, _len; | ||
getEncodingSync: function(buffer, opts) { | ||
var binaryEncoding, charCode, chunkBegin, chunkEnd, chunkLength, contentChunkUTF8, encoding, i, textEncoding, _i, _ref4; | ||
var binaryEncoding, charCode, chunkBegin, chunkEnd, chunkLength, contentChunkUTF8, encoding, i, textEncoding, _i, _ref6; | ||
textEncoding = 'utf8'; | ||
@@ -219,3 +221,3 @@ binaryEncoding = 'binary'; | ||
encoding = textEncoding; | ||
for (i = _i = 0, _ref4 = contentChunkUTF8.length; 0 <= _ref4 ? _i < _ref4 : _i > _ref4; i = 0 <= _ref4 ? ++_i : --_i) { | ||
for (i = _i = 0, _ref6 = contentChunkUTF8.length; 0 <= _ref6 ? _i < _ref6 : _i > _ref6; i = 0 <= _ref6 ? ++_i : --_i) { | ||
charCode = contentChunkUTF8.charCodeAt(i); | ||
@@ -294,9 +296,13 @@ if (charCode === 65533 || charCode <= 8) { | ||
isDirectory: function(path, next) { | ||
balUtilPaths.stat(path, function(err, stat) { | ||
if (err) { | ||
console.log("balUtilPaths.isDirectory: stat failed on: " + path); | ||
return next(err); | ||
} | ||
return next(null, stat.isDirectory(), stat); | ||
}); | ||
if ((path != null ? path.isDirectory : void 0) != null) { | ||
return next(null, path.isDirectory(), path); | ||
} else { | ||
balUtilPaths.stat(path, function(err, stat) { | ||
if (err) { | ||
console.log("balUtilPaths.isDirectory: stat failed on: " + path); | ||
return next(err); | ||
} | ||
return next(null, stat.isDirectory(), stat); | ||
}); | ||
} | ||
return this; | ||
@@ -331,5 +337,19 @@ }, | ||
}, | ||
commonIgnorePatterns: /^((~).*|.*(\.swp)|\.(svn|git|hg|DS_Store)|node_modules|CVS|thumbs\.db|desktop\.ini)$/i, | ||
testIgnorePatterns: function(path, opts) { | ||
var basename, result, _ref6, _ref7; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
basename = pathUtil.basename(path); | ||
if ((_ref6 = opts.ignoreCommonPatterns) == null) { | ||
opts.ignoreCommonPatterns = balUtilPaths.ignoreCommonPatterns; | ||
} | ||
if ((_ref7 = opts.ignoreCustomPatterns) == null) { | ||
opts.ignoreCustomPatterns = null; | ||
} | ||
result = (opts.ignoreCommonPatterns && opts.ignoreCommonPatterns.test(basename)) || (opts.ignoreCustomPatterns && opts.ignoreCustomPatterns.test(basename)) || false; | ||
return result; | ||
}, | ||
scandir: function() { | ||
var args, err, list, options, tasks, tree, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; | ||
var args, err, list, options, tasks, tree, _ref10, _ref11, _ref6, _ref7, _ref8, _ref9; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
@@ -355,24 +375,24 @@ list = {}; | ||
} | ||
if ((_ref4 = options.recurse) == null) { | ||
if ((_ref6 = options.recurse) == null) { | ||
options.recurse = true; | ||
} | ||
if ((_ref5 = options.readFiles) == null) { | ||
if ((_ref7 = options.readFiles) == null) { | ||
options.readFiles = false; | ||
} | ||
if ((_ref6 = options.ignoreHiddenFiles) == null) { | ||
if ((_ref8 = options.ignoreHiddenFiles) == null) { | ||
options.ignoreHiddenFiles = false; | ||
} | ||
if ((_ref7 = options.ignorePatterns) == null) { | ||
options.ignorePatterns = false; | ||
if ((_ref9 = options.ignoreCommonPatterns) == null) { | ||
options.ignoreCommonPatterns = false; | ||
} | ||
if (options.action != null) { | ||
if ((_ref8 = options.fileAction) == null) { | ||
if ((_ref10 = options.fileAction) == null) { | ||
options.fileAction = options.action; | ||
} | ||
if ((_ref9 = options.dirAction) == null) { | ||
if ((_ref11 = options.dirAction) == null) { | ||
options.dirAction = options.action; | ||
} | ||
} | ||
if (options.ignorePatterns === true) { | ||
options.ignorePatterns = balUtilPaths.commonIgnorePatterns; | ||
if (options.ignoreCommonPatterns === true) { | ||
options.ignoreCommonPatterns = balUtilPaths.ignoreCommonPatterns; | ||
} | ||
@@ -407,3 +427,6 @@ if (options.parentPath && !options.path) { | ||
isHiddenFile = options.ignoreHiddenFiles && /^\./.test(file); | ||
isIgnoredFile = options.ignorePatterns && options.ignorePatterns.test(file); | ||
isIgnoredFile = balUtilPaths.testIgnorePatterns(file, { | ||
ignoreCommonPatterns: options.ignoreCommonPatterns, | ||
ignoreCustomPatterns: options.ignoreCustomPatterns | ||
}); | ||
if (isHiddenFile || isIgnoredFile) { | ||
@@ -521,6 +544,6 @@ return tasks.complete(); | ||
cpdir: function() { | ||
var args, err, ignoreHiddenFiles, ignorePatterns, next, outPath, scandirOptions, srcPath, _ref4; | ||
var args, err, ignoreHiddenFiles, ignorePatterns, next, outPath, scandirOptions, srcPath, _ref6; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
if (args.length === 1) { | ||
_ref4 = args[0], srcPath = _ref4.srcPath, outPath = _ref4.outPath, next = _ref4.next, ignoreHiddenFiles = _ref4.ignoreHiddenFiles, ignorePatterns = _ref4.ignorePatterns; | ||
_ref6 = args[0], srcPath = _ref6.srcPath, outPath = _ref6.outPath, next = _ref6.next, ignoreHiddenFiles = _ref6.ignoreHiddenFiles, ignorePatterns = _ref6.ignorePatterns; | ||
} else if (args.length >= 3) { | ||
@@ -566,6 +589,6 @@ srcPath = args[0], outPath = args[1], next = args[2]; | ||
rpdir: function() { | ||
var args, err, ignoreHiddenFiles, ignorePatterns, next, outPath, scandirOptions, srcPath, _ref4; | ||
var args, err, ignoreHiddenFiles, ignorePatterns, next, outPath, scandirOptions, srcPath, _ref6; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
if (args.length === 1) { | ||
_ref4 = args[0], srcPath = _ref4.srcPath, outPath = _ref4.outPath, next = _ref4.next, ignoreHiddenFiles = _ref4.ignoreHiddenFiles, ignorePatterns = _ref4.ignorePatterns; | ||
_ref6 = args[0], srcPath = _ref6.srcPath, outPath = _ref6.outPath, next = _ref6.next, ignoreHiddenFiles = _ref6.ignoreHiddenFiles, ignorePatterns = _ref6.ignorePatterns; | ||
} else if (args.length >= 3) { | ||
@@ -695,4 +718,4 @@ srcPath = args[0], outPath = args[1], next = args[2]; | ||
return res.on('end', function() { | ||
var locationHeader, _ref4; | ||
locationHeader = ((_ref4 = res.headers) != null ? _ref4.location : void 0) || null; | ||
var locationHeader, _ref6; | ||
locationHeader = ((_ref6 = res.headers) != null ? _ref6.location : void 0) || null; | ||
if (locationHeader && locationHeader !== requestOptions.href) { | ||
@@ -699,0 +722,0 @@ return balUtilPaths.readPath(locationHeader, next); |
{ | ||
"name": "bal-util", | ||
"version": "1.14.1", | ||
"version": "1.15.0", | ||
"description": "Common utility functions for Node.js used and maintained by Benjamin Lupton", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/balupton/bal-util", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
101745
2414
44