Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-tree-walker

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tree-walker - npm Package Compare versions

Comparing version 2.0.0-alpha.3 to 2.0.0

2

package.json
{
"name": "react-tree-walker",
"version": "2.0.0-alpha.3",
"version": "2.0.0",
"description": "Walk a React element tree, executing a provided function against each node.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -71,13 +71,18 @@ # react-tree-walker 🌲

*
* @return `undefined` if you want to continue walking down the current branch,
* or return `false` if you wish to stop the traversal down the
* current branch. Stopping the traversal can be quite handy if
* you want to resolve a Promise for example. You can wait for the
* Promise to resolve and then execute a function to continue
* traversal of the branch where you left off.
* @return `true` to continue walking down the current branch,
* OR
* `false` if you wish to stop the traversal down the current branch,
* OR
* `Promise<true|false>` a promise that resolves to either true/false
*/
function visitor(element, instance, context) {
if (instance && typeof instance.getValue) {
const value = instance.getValue()
if (value === 4) {
// stop traversal on this branch of tree.
return false
}
values.push(instance.getValue());
}
return true
};

@@ -87,3 +92,3 @@

console.log(values); // [1, 2, 4, 5, 3];
console.log(values); // [1, 2, 4, 3];
```

@@ -90,0 +95,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc