flatterator
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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*/
}

Package Sidebar

Install

npm i flatterator

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

7.07 kB

Total Files

8

Last publish

Collaborators

  • ocoka