https://github.com/privatenumber/bfs
Find the path of a value in a complex JavaScript object graph/tree.
https://github.com/privatenumber/bfs
bfs breadth-first-search debugging search
Last synced: 7 months ago
JSON representation
Find the path of a value in a complex JavaScript object graph/tree.
- Host: GitHub
- URL: https://github.com/privatenumber/bfs
- Owner: privatenumber
- License: mit
- Created: 2020-11-20T01:33:53.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2020-12-28T22:17:55.000Z (almost 5 years ago)
- Last Synced: 2025-03-18T15:55:08.547Z (7 months ago)
- Topics: bfs, breadth-first-search, debugging, search
- Language: JavaScript
- Homepage:
- Size: 218 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bfs [](https://npm.im/bfs) [](https://npm.im/bfs) [](https://packagephobia.now.sh/result?p=bfs) [](https://bundlephobia.com/result?p=bfs)
Find the path of a value in a complex JavaScript object graph/tree.
This module is BFS ([Breadth-first Search](https://en.wikipedia.org/wiki/Breadth-first_search)) as a debugging tool to help with quickly understanding the relationships within an object tree/graph.
If you like this project, please star it & [follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️
## 🚦 Quick Setup
### In a local project
```sh
npm i --no-save bfs
``````js
import BFS from 'bfs';// Search the global scope for all properties that have the MAX_SAFE_INTEGER value
BFS(global, Number.MAX_SAFE_INTEGER);
```### In browser dev-tools
```js
const { default: BFS } = await import('//unpkg.com/bfs/dist/bfs.esm.js');// Search the global scope for all properties that have the MAX_SAFE_INTEGER value
BFS(global, Math.max);
```### In non ESM environments
```js
(function (cb) {
var s = document.createElement('script')
s.src = '//unpkg.com/bfs'
s.onload = cb
document.head.appendChild(s)
})(function () {// Search the global scope for all properties that have the MAX_SAFE_INTEGER value
BFS(global, Number.MAX_SAFE_INTEGER);
})
```## ⚙️ Options
- timeout (`10000`)
- maxFinds (`100`)
- silenceErrors (`true`)