source: node_modules/ramda-adjunct/es/spreadProp.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 856 bytes
RevLine 
[d24f17c]1import { of, curry } from 'ramda';
2import spreadPath from './spreadPath';
3
4/**
5 * Spreads object under property onto provided object.
6 * It's like {@link RA.flattenProp|flattenProp}, but removes object under the property.
7 *
8 * @func spreadProp
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
11 * @category Object
12 * @typedef Idx = String | Int
13 * @sig Idx -> {k: v} -> {k: v}
14 * @param {!string|number} prop The property to spread
15 * @param {!Object} obj The provided object
16 * @return {!Object} The result of the spread
17 * @see {@link RA.spreadPath|spreadPath}, {@link RA.flattenProp|flattenProp}
18 * @example
19 *
20 * RA.spreadProp('b', { a: 1, b: { c: 3, d: 4 } }); // => { a: 1, c: 3, d: 4 };
21 */
22var spreadProp = curry(function (prop, obj) {
23 return spreadPath(of(Array, prop), obj);
24});
25export default spreadProp;
Note: See TracBrowser for help on using the repository browser.