diff options
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; +} |