Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utile

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utile - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

lib/args.js

@@ -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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc