mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-03 04:59:31 +08:00
27 lines
No EOL
831 B
Text
27 lines
No EOL
831 B
Text
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.objectReduceKey = exports.objectMapKey = exports.objectForEachKey = void 0;
|
|
function objectForEachKey(obj, callback) {
|
|
const keys = Object.keys(obj);
|
|
for (const key of keys) {
|
|
callback(key);
|
|
}
|
|
}
|
|
exports.objectForEachKey = objectForEachKey;
|
|
function objectMapKey(obj, callback) {
|
|
const values = [];
|
|
objectForEachKey(obj, key => {
|
|
values.push(callback(key));
|
|
});
|
|
return values;
|
|
}
|
|
exports.objectMapKey = objectMapKey;
|
|
function objectReduceKey(obj, callback, initial) {
|
|
let accumulator = initial;
|
|
objectForEachKey(obj, key => {
|
|
accumulator = callback(accumulator, key);
|
|
});
|
|
return accumulator;
|
|
}
|
|
exports.objectReduceKey = objectReduceKey;
|
|
//# sourceMappingURL=objectIterators.js.map |