Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54aaa58990 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.30.10",
|
"version": "0.30.11",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -165,6 +165,15 @@ export function encodeQuery(data: any): string {
|
|||||||
).join('&');
|
).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Recursively walks obj/arrays, calling cb(dotPath, value) for every leaf+branch prop */
|
||||||
|
export function everyNested(obj: any, cb: (key: string, value: any) => void, prefix = ''){
|
||||||
|
Object.entries(obj).forEach(([k, v]) => {
|
||||||
|
const key = prefix ? `${prefix}.${k}` : k;
|
||||||
|
cb(key, v);
|
||||||
|
if (v && typeof v === 'object') everyNested(v, cb, key);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively flatten a nested object, while maintaining key structure
|
* Recursively flatten a nested object, while maintaining key structure
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user