detect-tree-changed
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

detect-tree-changed

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

Detect tow tree what is updated

Installation

npm install detect-tree-changed
# or use yarn 
yarn add detect-tree-changed

Usage

const detectTreeChanged = require('detect-tree-changed')
 
detectTreeChanged(
  {
    node: 'Root'
  },
  {
    node: 'root'
  }
)
 
// => Map {
  {node: 'Root'}: {status: 'updated', ctx: {...}}
}

It's shameless of use document of @moyuyc/visit-tree about the ctx which is returned.

API

detectTreeChanged

index.js:23-131

Parameters

  • treeA {T}
  • treeB {T}
  • opt Object {{}}
    • opt.limit The limit of changed node (optional, default Infinity)
    • opt.equal The compare strategy of two node (optional, default (a,b)=>a===b)
    • opt.path (optional, default 'children')

Returns Map

Related

Contributing

  • Fork it!
  • Create your new branch:
    git checkout -b feature-new or git checkout -b fix-which-bug
  • Start your magic work now
  • Make sure npm test passes
  • Commit your changes:
    git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
  • Push to the branch: git push
  • Submit a pull request :)

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT - imcuttle 🐟

Package Sidebar

Install

npm i detect-tree-changed

Weekly Downloads

12

Version

1.2.4

License

MIT

Unpacked Size

27.3 kB

Total Files

20

Last publish

Collaborators

  • moyuyc