Comparing version 0.7.0 to 0.8.0
@@ -433,6 +433,7 @@ "use strict"; | ||
/** | ||
Returns the input array, minus the specied values | ||
@param {Array} - the input array | ||
If the input is an array, returns the input minus the specified values. | ||
If the input is an object, it returns a clone of the object minus the specified properties. | ||
@param {Array|Object} - the input array or object | ||
@param {*} - a single, or array of values to omit | ||
@returns {Array} | ||
@returns {Array|Object} | ||
@example | ||
@@ -444,7 +445,15 @@ > w.without([ 1, 2, 3 ], 2) | ||
*/ | ||
function without(array, toRemove){ | ||
function without(input, toRemove){ | ||
toRemove = arrayify(toRemove); | ||
return array.filter(function(item){ | ||
return !exists(toRemove, item); | ||
}); | ||
if (Array.isArray(input)){ | ||
return input.filter(function(item){ | ||
return !exists(toRemove, item); | ||
}); | ||
} else { | ||
var output = clone(input); | ||
toRemove.forEach(function(remove){ | ||
delete output[remove]; | ||
}); | ||
return output; | ||
} | ||
} | ||
@@ -451,0 +460,0 @@ |
{ | ||
"name": "wodge", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "a wodge of functional dough", | ||
@@ -5,0 +5,0 @@ "main": "lib/wodge.js", |
34686
18
816