Comparing version 0.1.1 to 0.1.2
@@ -22,3 +22,3 @@ /* | ||
_cb; | ||
// | ||
@@ -25,0 +25,0 @@ // Find and define the first argument |
@@ -51,2 +51,13 @@ /* | ||
// | ||
// ### function deepEqual | ||
// Simple wrapper to `require('deep-equal')` | ||
// Remark: deepEqual is 4x faster then using assert.deepEqual | ||
// see: https://gist.github.com/2790507 | ||
// | ||
utile.__defineGetter__('deepEqual', function () { | ||
delete utile.deepEqual; | ||
return utile.deepEqual = require('deep-equal'); | ||
}); | ||
// | ||
// ### function rimraf | ||
@@ -100,3 +111,3 @@ // Simple wrapper to `require('rimraf')` | ||
// | ||
// Top-level method will accept a javascript "arguments" object | ||
// Top-level method will accept a javascript "arguments" object | ||
// (the actual keyword "arguments" inside any scope) and return | ||
@@ -109,7 +120,7 @@ // back an Array. | ||
} | ||
var len = (_args || []).length, | ||
args = new Array(len - slice), | ||
i; | ||
// | ||
@@ -121,3 +132,3 @@ // Convert the raw `_args` to a proper Array. | ||
} | ||
return args; | ||
@@ -154,3 +165,25 @@ }; | ||
// | ||
// ### function createPath (obj, path, value) | ||
// ### function pad (str, len, chr) | ||
// ### @str {String} String to pad | ||
// ### @len {Number} Number of chars to pad str with | ||
// ### @chr {String} Optional replacement character, defaults to empty space | ||
// Appends chr to str until it reaches a length of len | ||
// | ||
utile.pad = function pad(str, len, chr) { | ||
var s; | ||
if (!chr) { | ||
chr = ' '; | ||
} | ||
str = str || ''; | ||
s = str; | ||
if (str.length < len) { | ||
for (var i = 0; i < (len - str.length); i++) { | ||
s += chr; | ||
} | ||
} | ||
return s; | ||
} | ||
// | ||
// ### function path (obj, path, value) | ||
// ### @obj {Object} Object to insert value into | ||
@@ -207,3 +240,3 @@ // ### @path {Array} List of nested keys to insert value at | ||
setter = o.__lookupSetter__(attr); | ||
if (!getter && !setter) { | ||
@@ -231,2 +264,11 @@ target[attr] = o[attr]; | ||
// | ||
// ### function escapeRegExp (str) | ||
// #### @str {string} String to be escaped | ||
// Escape string for use in Javascript regex | ||
// | ||
utile.escapeRegExp = function (str) { | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | ||
}; | ||
// | ||
// ### function randomString (length) | ||
@@ -233,0 +275,0 @@ // #### @length {integer} The number of bits for the random base64 string returned to contain |
{ | ||
"name": "utile", | ||
"description": "A drop-in replacement for `util` with some additional advantageous functions", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
@@ -15,2 +15,3 @@ "maintainers": [ | ||
"async": "0.1.x", | ||
"deep-equal": "*", | ||
"i": "0.3.x", | ||
@@ -25,3 +26,3 @@ "mkdirp": "0.x.x", | ||
"scripts": { | ||
"test": "vows --spec --isolate" | ||
"test": "vows --spec" | ||
}, | ||
@@ -28,0 +29,0 @@ "main": "./lib/index", |
@@ -73,3 +73,3 @@ /* | ||
return utile.args(arguments); | ||
})('a', 'b', 'c', function () { | ||
})('a', 'b', 'c', function () { | ||
return 'ok'; | ||
@@ -76,0 +76,0 @@ }); |
@@ -82,5 +82,10 @@ /* | ||
assert.equal(utile.capitalize('bullet_train'), 'BulletTrain'); | ||
} | ||
}, | ||
"the escapeRegExp() method": function () { | ||
var ans = "\\/path\\/to\\/resource\\.html\\?search=query"; | ||
assert.isFunction(utile.escapeRegExp); | ||
assert.equal(utile.escapeRegExp('/path/to/resource.html?search=query'), ans); | ||
}, | ||
} | ||
}).export(module); | ||
Sorry, the diff of this file is not supported yet
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
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
26784
746
6
1
+ Addeddeep-equal@*
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddeep-equal@2.2.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-get-iterator@1.1.3(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-arguments@1.1.1(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakset@2.0.3(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-is@1.1.6(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstop-iteration-iterator@1.0.0(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)