main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1013 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports["default"] = void 0;
|
---|
5 | var _ramda = require("ramda");
|
---|
6 | /**
|
---|
7 | * Spreads object under property path onto provided object.
|
---|
8 | * It's like {@link RA.flattenPath|flattenPath}, but removes object under the property path.
|
---|
9 | *
|
---|
10 | * @func spreadPath
|
---|
11 | * @memberOf RA
|
---|
12 | * @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
|
---|
13 | * @category Object
|
---|
14 | * @typedef Idx = String | Int
|
---|
15 | * @sig [Idx] -> {k: v} -> {k: v}
|
---|
16 | * @param {!Array.<string|number>} path The property path to spread
|
---|
17 | * @param {!Object} obj The provided object
|
---|
18 | * @return {!Object} The result of the spread
|
---|
19 | * @see {@link RA.spreadProp|spreadProp}, {@link RA.flattenPath|flattenPath}
|
---|
20 | * @example
|
---|
21 | *
|
---|
22 | * RA.spreadPath(
|
---|
23 | * ['b1', 'b2'],
|
---|
24 | * { a: 1, b1: { b2: { c: 3, d: 4 } } }
|
---|
25 | * ); // => { a: 1, c: 3, d: 4, b1: {} };
|
---|
26 | */
|
---|
27 | var spreadPath = (0, _ramda.curryN)(2, (0, _ramda.converge)(_ramda.mergeRight, [_ramda.dissocPath, (0, _ramda.pathOr)({})]));
|
---|
28 | var _default = spreadPath;
|
---|
29 | exports["default"] = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.