mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
31 lines
909 B
TypeScript
31 lines
909 B
TypeScript
|
// Loaded from https://deno.land/x/ramda@v0.27.2/source/mergeAll.js
|
||
|
|
||
|
|
||
|
import _objectAssign from './internal/_objectAssign.js';
|
||
|
import _curry1 from './internal/_curry1.js';
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Creates one new object with the own properties from a list of objects.
|
||
|
* If a key exists in more than one object, the value from the last
|
||
|
* object it exists in will be used.
|
||
|
*
|
||
|
* @func
|
||
|
* @memberOf R
|
||
|
* @since v0.10.0
|
||
|
* @category List
|
||
|
* @sig [{k: v}] -> {k: v}
|
||
|
* @param {Array} list An array of objects
|
||
|
* @return {Object} A merged object.
|
||
|
* @see R.reduce
|
||
|
* @example
|
||
|
*
|
||
|
* R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}
|
||
|
* R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}
|
||
|
* @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 }
|
||
|
*/
|
||
|
var mergeAll = _curry1(function mergeAll(list) {
|
||
|
return _objectAssign.apply(null, [{}].concat(list));
|
||
|
});
|
||
|
export default mergeAll;
|