Skip to content
Malexion edited this page Oct 31, 2016 · 1 revision

__.map(obj, [func], [options])

  • obj Item to iterate over.
  • [func] [Optional] Function to evaluate the item.
  • [options] [Optional] Params { manual: false, pushMultiple: false, build: [] }

Examples

var simple = __.map({ 5: 1, 4: 2, 3: 3 });

console.log(simple);

// Build a lookup index for your array
var index = __.map([ 1, 5, 3, 4, 2 ], (x, y) => { return { key: x, value: y }; }, { build: {} });

console.log(index);
console.log(index[5]); // get the index in the array of the item with value 5
Clone this wiki locally