Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "wodge", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "a wodge of functional dough", | ||
@@ -9,4 +9,7 @@ "main": "wodge.js", | ||
"devDependencies": { | ||
"tape": "^2.10.2" | ||
"tape": "~2.10.2" | ||
}, | ||
"scripts": { | ||
"test": "node test/api.js" | ||
} | ||
} |
@@ -11,5 +11,2 @@ var test = require("tape"), | ||
output = w.extend({}, { one: 1, three: 3 }, { one: "one", two: 2 }, { four: 4 }); | ||
t.deepEqual(output, { one: "one", two: 2, three: 3, four: 4 }); | ||
t.end(); | ||
@@ -16,0 +13,0 @@ }); |
27
wodge.js
@@ -45,4 +45,4 @@ "use strict"; | ||
function omit(obj, toOmit){ | ||
toOmit = exports.arrayify(toOmit); | ||
var output = exports.clone(obj); | ||
toOmit = arrayify(toOmit); | ||
var output = clone(obj); | ||
for (var prop in toOmit){ | ||
@@ -54,2 +54,8 @@ delete output[prop]; | ||
/** | ||
escape special regular expression characters | ||
@method | ||
@example | ||
w.escapeRegExp("(.*)"); // => '\\(\\.\\*\\)' | ||
*/ | ||
function escapeRegExp(string){ | ||
@@ -61,2 +67,13 @@ return string | ||
/** | ||
return an array containing the property names of `object` which pass the test function | ||
@method | ||
@example | ||
var obj = { | ||
clive: 1, | ||
hater: 3 | ||
}; | ||
var list = w.pluck(obj, function(val){ return val === 1}); | ||
// list is [ "clive" ] | ||
*/ | ||
function pluck(object, fn){ | ||
@@ -140,3 +157,3 @@ var output = []; | ||
if (input.length < width){ | ||
return input + exports.fill(padWith, width - input.length); | ||
return input + fill(padWith, width - input.length); | ||
} else { | ||
@@ -152,6 +169,6 @@ return input; | ||
function without(arr, toRemove){ | ||
toRemove = exports.arrayify(toRemove); | ||
toRemove = arrayify(toRemove); | ||
return arr.filter(function(item){ | ||
return !exports.exists(toRemove, item); | ||
return !exists(toRemove, item); | ||
}); | ||
}; |
5438
165