ReduceObject - jQuery Plugin
Plain JavaScript objects reduce as known from the Array.prototype
Release with Dependencies !!!
If you include the jquery.reduce-object.min.js
only, be sure jQuery is part of your Project.
You will get it here:
Install - Demo
- Download
npm install
Run - Demo
node server.js
- Open your browser at
localhost:1234
API
var result = $;
The reduceObject
function takes following arguments:
obj: {Object} -> the object to reducecallback: {function} -> the function to reduce withacc: {*} -> the initial value given the first iteration as 'dest' argument
The callback
function receives following arguments:
dest -> previous valuecurr -> actual value in iterationkey -> actual key in iterationobj -> the original object
Usage
- Include
jquery.reduce-object.min.js
into your Project
var objA = keyA = value: 2 keyB = value: 9 ; var result = $; console; // { value: 42 }
Contributors
- Patrick Gräf - graef685@googlemail.com