@jswork/next-traverse

1.0.1 • Public • Published

next-traverse

Traverse object which has items key.

version license size download

installation

npm install -S @jswork/next-traverse

usage

import '@feizheng/next-traverse';

const data = {
  tagName:'div',
  children:[
    {
      tagName:'p',
      content:'Content1'
    },
    {
      tagName:'p',
      content:'Content2'
    }
  ]
};

// walk your object/array:
nx.traverse(data,(index, value, children)=>{
  console.log(children);
}, { itemsKey: 'children'});

options

name type default description
itemsKey string/function 'items' The target children key.
context object null The loop context.
inject boolean false If inject independent and depth to the tree item.

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/next-traverse

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

6.2 kB

Total Files

5

Last publish

Collaborators

  • afeiship