This is a set of supplementary prototype additions to the Object class that provide filtration functions analogous to that of Array.prototype.filter()
.
npm install --save object-prototype-filter
bower install --save object-prototype-filter
<script src="path/to/directory/object-prototype-filter.js"></script>
This supplement adds the following prototype methods to the Object class:
-
Object.prototype.filterValues(callback)
- Creates a new object with all entries that pass the test implemented by the provided function.callback(key, object, thisArg)
Function is a predicate, to test each element of the array. Return true to keep the element, false otherwise, taking two arguments:
key
the current key being processed in the object.
object
the object filter was called upon.
thisArg
Optional. Value to use as this when executing callback.return A new objet with the elements that pass the test.
npm run build
- Build and minify
This project is licensed under the MIT License - see the LICENSE.txt file for details