mirror of
https://github.com/directus/directus.git
synced 2026-02-09 07:35:18 -05:00
Merge branch 'main' into feature-rate-limiting
This commit is contained in:
9
api/src/utils/deep-map.ts
Normal file
9
api/src/utils/deep-map.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user