1 | ;
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | /**
|
6 | * Does nothing.
|
7 | */
|
8 | function noop() {}
|
9 | /**
|
10 | * A function that only returns the first parameter passed to it.
|
11 | * @param {any} x The first parameter
|
12 | * @returns {any}
|
13 | */
|
14 |
|
15 | function identity(x) {
|
16 | return x;
|
17 | }
|
18 | /**
|
19 | * Creates a new object from obj that only contains specific keys.
|
20 | * @param {object} obj The source object.
|
21 | * @param {array} keys The keys to pick in the source object.
|
22 | * @returns {object}
|
23 | */
|
24 |
|
25 | function pick(obj, keys) {
|
26 | return keys.reduce(function (filtered, key) {
|
27 | if (obj[key] !== undefined) {
|
28 | filtered[key] = obj[key];
|
29 | }
|
30 |
|
31 | return filtered;
|
32 | }, {});
|
33 | }
|
34 |
|
35 | exports.identity = identity;
|
36 | exports.noop = noop;
|
37 | exports.pick = pick;
|
38 | //# sourceMappingURL=miscellaneous.js.map
|