indexBy.js 290 B

1234567891011
  1. define(['./_group'], function (_group) {
  2. // Indexes the object's values by a criterion, similar to `_.groupBy`, but for
  3. // when you know that your index values will be unique.
  4. var indexBy = _group(function(result, value, key) {
  5. result[key] = value;
  6. });
  7. return indexBy;
  8. });