1.2.4 • Published 6 years ago
detect-tree-changed v1.2.4
detect-tree-changed
Detect tow tree what is updated
Installation
npm install detect-tree-changed
# or use yarn
yarn add detect-tree-changedUsage
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
Parameters
treeA{T}treeB{T}optObject {{}}opt.limitThe limit of changed node (optional, defaultInfinity)opt.equalThe compare strategy of two node (optional, default(a,b)=>a===b)opt.path(optional, default'children')
Returns Map
Related
- @moyuyc/visit-tree - Visit tree by pre or post DFS.
- detect-one-changed - Detect first changed html and markdown between old text and new.
Contributing
- Fork it!
- Create your new branch:
git checkout -b feature-neworgit 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)'orgit 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 🐟