2.1.3 • Published 4 years ago

@feizheng/next-traverse v2.1.3

Weekly downloads
8
License
MIT
Repository
-
Last release
4 years ago

next-traverse

Traverse object which has items key.

version license size download

installation

npm install -S @feizheng/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

nametypedefaultdescription
itemsKeystring/function'items'The target children key.
contextobjectnullThe loop context.
injectbooleanfalseIf inject independent and depth to the tree item.

license

Code released under the MIT license.

2.1.2

4 years ago

2.1.1

4 years ago

2.1.3

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago