1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.objectReduceKey = exports.objectMapKey = exports.objectForEachKey = void 0;
|
4 | function objectForEachKey(obj, callback) {
|
5 | const keys = Object.keys(obj);
|
6 | for (const key of keys) {
|
7 | callback(key);
|
8 | }
|
9 | }
|
10 | exports.objectForEachKey = objectForEachKey;
|
11 | function objectMapKey(obj, callback) {
|
12 | const values = [];
|
13 | objectForEachKey(obj, key => {
|
14 | values.push(callback(key));
|
15 | });
|
16 | return values;
|
17 | }
|
18 | exports.objectMapKey = objectMapKey;
|
19 | function objectReduceKey(obj, callback, initial) {
|
20 | let accumulator = initial;
|
21 | objectForEachKey(obj, key => {
|
22 | accumulator = callback(accumulator, key);
|
23 | });
|
24 | return accumulator;
|
25 | }
|
26 | exports.objectReduceKey = objectReduceKey;
|
27 |
|
\ | No newline at end of file |