mirror of
https://github.com/directus/directus.git
synced 2026-02-03 18:05:29 -05:00
8 lines
319 B
TypeScript
8 lines
319 B
TypeScript
import { transform, isPlainObject } from 'lodash';
|
|
|
|
export function deepMap(obj: Record<string, any>, iterator: Function, context?: Function) {
|
|
return transform(obj, function (result: any, val, key) {
|
|
result[key] = isPlainObject(val) ? deepMap(val, iterator, context) : iterator.call(context, val, key, obj);
|
|
});
|
|
}
|