I have an object in JavaScript:
{
abc: \'...\',
bca: \'...\',
zzz: \'...\',
xxx: \'...\',
ccc: \'...\',
// ...
}
I
I finally came up with a handy utility function with a unified interface to iterate Objects, Strings, Arrays, TypedArrays, Maps, Sets, (any Iterables).
const iterate = require('@a-z/iterate-it');
const obj = { a: 1, b: 2, c: 3 };
iterate(obj, (value, key) => console.log(key, value));
// a 1
// b 2
// c 3
https://github.com/alrik/iterate-javascript