flatterator
v1.0.0
Published
make an iterator linearly passing through the elements of the array and inside the indicated by the parameter of their nested structures
Downloads
7
Maintainers
Readme
It just can iterate over array where items can itself has a children so it make it in flatten way
const flatterator = require('flatterator).flatterator;
const data = [
{
a: 1
},
{
a: 2
},
{
a: 3,
someChild: [
{
a: 4
}
]
}
];
for (const i of flatterator(data, 'someChild' /* or array of props to be visited*/) {
console.log( i.a ); /* 1, 2 , 3, 4 will be printed*/
}