Skip to content

Commit 6af33a0

Browse files
committed
feat: update deepmap
1 parent c3ba3d8 commit 6af33a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/deep-map.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
type DeepMapFn = (val: any) => any;
2-
type MapObjectFn = (obj: Record<string, any>, fn: DeepMapFn) => Record<string, any>;
2+
type MapObjectFn = (
3+
obj: Record<string, any>,
4+
fn: DeepMapFn
5+
) => Record<string, any>;
36

47
const deepMap = (obj: any, fn: DeepMapFn): any => {
58
const deepMapper = (val: any) => (isObject(val) ? deepMap(val, fn) : fn(val));
@@ -21,6 +24,7 @@ const mapObject: MapObjectFn = (obj, fn) => {
2124
);
2225
};
2326

24-
const isObject = (myVar: any): boolean => myVar !== null && typeof myVar === "object";
27+
const isObject = (myVar: any): boolean =>
28+
myVar !== null && typeof myVar === 'object';
2529

2630
export default deepMap;

0 commit comments

Comments
 (0)