@yookue/ts-lang-utils
Version:
Common lang utilities for typescript
14 lines • 430 B
JavaScript
import { isPlain } from "./isPlain";
import { setProp } from "./setProp";
export function regenProps(object, callback) {
if (!object || !isPlain(object) || !callback) {
return object;
}
var result = {};
Object.keys(object).filter(function (key) {
return Object.prototype.hasOwnProperty.call(object, key);
}).forEach(function (key, index) {
setProp(result, key, callback(key, index));
});
return result;
}