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:
964 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry2 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry2.js");
|
---|
| 4 | /**
|
---|
| 5 | * Similar to `pick` except that this one includes a `key: undefined` pair for
|
---|
| 6 | * properties that don't exist.
|
---|
| 7 | *
|
---|
| 8 | * @func
|
---|
| 9 | * @memberOf R
|
---|
| 10 | * @since v0.1.0
|
---|
| 11 | * @category Object
|
---|
| 12 | * @sig [k] -> {k: v} -> {k: v}
|
---|
| 13 | * @param {Array} names an array of String property names to copy onto a new object
|
---|
| 14 | * @param {Object} obj The object to copy from
|
---|
| 15 | * @return {Object} A new object with only properties from `names` on it.
|
---|
| 16 | * @see R.pick
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
|
---|
| 20 | * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined}
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | var pickAll =
|
---|
| 25 | /*#__PURE__*/
|
---|
| 26 | _curry2(function pickAll(names, obj) {
|
---|
| 27 | var result = {};
|
---|
| 28 | var idx = 0;
|
---|
| 29 | var len = names.length;
|
---|
| 30 |
|
---|
| 31 | while (idx < len) {
|
---|
| 32 | var name = names[idx];
|
---|
| 33 | result[name] = obj[name];
|
---|
| 34 | idx += 1;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | return result;
|
---|
| 38 | });
|
---|
| 39 |
|
---|
| 40 | module.exports = pickAll; |
---|
Note:
See
TracBrowser
for help on using the repository browser.