update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
964 changed files with 104265 additions and 16 deletions
33
node_modules/ramda/src/indexBy.js
generated
vendored
Normal file
33
node_modules/ramda/src/indexBy.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
var reduceBy =
|
||||
/*#__PURE__*/
|
||||
require("./reduceBy");
|
||||
/**
|
||||
* Given a function that generates a key, turns a list of objects into an
|
||||
* object indexing the objects by the given key. Note that if multiple
|
||||
* objects generate the same value for the indexing key only the last value
|
||||
* will be included in the generated object.
|
||||
*
|
||||
* Acts as a transducer if a transformer is given in list position.
|
||||
*
|
||||
* @func
|
||||
* @memberOf R
|
||||
* @since v0.19.0
|
||||
* @category List
|
||||
* @sig (a -> String) -> [{k: v}] -> {k: {k: v}}
|
||||
* @param {Function} fn Function :: a -> String
|
||||
* @param {Array} array The array of objects to index
|
||||
* @return {Object} An object indexing each array element by the given property.
|
||||
* @example
|
||||
*
|
||||
* const list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}];
|
||||
* R.indexBy(R.prop('id'), list);
|
||||
* //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}
|
||||
*/
|
||||
|
||||
|
||||
var indexBy =
|
||||
/*#__PURE__*/
|
||||
reduceBy(function (acc, elem) {
|
||||
return elem;
|
||||
}, null);
|
||||
module.exports = indexBy;
|
Loading…
Add table
Add a link
Reference in a new issue