This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add attributes to each object of an array. | |
* | |
* @param {array} foo - Array of objects where we will add the attibutes | |
* @param {function} iterator | |
*/ | |
_.each(foo, function(element, index) { | |
_.extend(element, {field1: index}, {field2: 'bar', field3: 'baz'}); | |
}); |