mirror of
https://github.com/directus/directus.git
synced 2026-01-25 21:18:31 -05:00
10 lines
325 B
TypeScript
10 lines
325 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);
|
|
});
|
|
}
|