Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 24, 2024 via pnpm

traverse 0.6.8

traverse and transform objects by visiting every node on a recursive walk
Package summary
Share
0
issues
1
license
1
MIT
Package created
3 Feb 2011
Version published
20 Dec 2023
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
traverse@0.6.8
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of traverse 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does traverse do?

The traverse npm package allows for the traversal and transformation of JavaScript objects. It conducts a recursive walk, visiting each element or node within the object, and provides a variety of methods for interaction and manipulation with these nodes. This can be useful for a wide range of operations, such as transforming values, collecting leaf nodes, removing circular references, and much more.

How do you use traverse?

You can use traverse in your JavaScript projects by installing it via npm using the command npm install traverse. Here's an example of how to use traverse to transform negative numbers in an array into their equivalent positive numbers:

var traverse = require('traverse');
var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ];

traverse(obj).forEach(function (x) {
    if (x < 0) this.update(x + 128);
});

console.dir(obj);

In the above example, traverse(obj).forEach(function (x) {...}) is looping through each element ('x') in the object, checking if it's less than zero (a negative number), and if so, updating that element in-place to transform it from a negative to a positive number by adding 128 to it.

Where are the traverse docs?

The traverse documentation can be found directly in the README file on its GitHub repository, which is located at https://github.com/ljharb/traverse. The documentation includes a list of all the available methods, their descriptions, usage examples, and details about their method-specific context values.