diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-07-11 13:01:41 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-07-11 13:01:41 +0200 |
commit | e99ae80f7adc0f0e677381c3cc1549235d3877ab (patch) | |
tree | 57362ddfa0ee2704cf7042d72559c479283ea1df /util | |
parent | 479836dbf3c7cc6e5940abe698ccc5e1d7b440c7 (diff) |
small cleanup
Diffstat (limited to 'util')
-rw-r--r-- | util/object.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/object.ts b/util/object.ts new file mode 100644 index 0000000..fc25f50 --- /dev/null +++ b/util/object.ts @@ -0,0 +1,12 @@ +export function recursiveValues(obj: { [k: string]: any }): any[] { + let values = []; + for (let key in obj) { + let val = obj[key]; + if (typeof val === "object") { + values.push(...recursiveValues(val)); + } else { + values.push(val); + } + } + return values; +} |