1 | var _curry2 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry2");
|
4 | /**
|
5 | * Returns a partial copy of an object containing only the keys that satisfy
|
6 | * the supplied predicate.
|
7 | *
|
8 | * @func
|
9 | * @memberOf R
|
10 | * @since v0.8.0
|
11 | * @category Object
|
12 | * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v}
|
13 | * @param {Function} pred A predicate to determine whether or not a key
|
14 | * should be included on the output object.
|
15 | * @param {Object} obj The object to copy from
|
16 | * @return {Object} A new object with only properties that satisfy `pred`
|
17 | * on it.
|
18 | * @see R.pick, R.filter
|
19 | * @example
|
20 | *
|
21 | * const isUpperCase = (val, key) => key.toUpperCase() === key;
|
22 | * R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
|
23 | */
|
24 |
|
25 |
|
26 | var pickBy =
|
27 | /*#__PURE__*/
|
28 | _curry2(function pickBy(test, obj) {
|
29 | var result = {};
|
30 |
|
31 | for (var prop in obj) {
|
32 | if (test(obj[prop], prop, obj)) {
|
33 | result[prop] = obj[prop];
|
34 | }
|
35 | }
|
36 |
|
37 | return result;
|
38 | });
|
39 |
|
40 | module.exports = pickBy; |
\ | No newline at end of file |