I have written this small function to get all keys and values of an object and store them into an array. The object might contain arrays as values...
Object {
If you're feeling really lazy then you can make use of the popular NPM library flat.
Example (from their docs)
var flatten = require('flat')
flatten({
key1: {
keyA: 'valueI'
},
key2: {
keyB: 'valueII'
},
key3: { a: { b: { c: 2 } } }
})
// {
// 'key1.keyA': 'valueI',
// 'key2.keyB': 'valueII',
// 'key3.a.b.c': 2
// }