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 5, 2024 via pnpm

acorn 8.8.2

ECMAScript parser
Package summary
Share
0
issues
1
license
1
MIT
Package created
24 Sep 2012
Version published
23 Jan 2023
Maintainers
3
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:
acorn@8.8.2
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 acorn 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does acorn do?

Acorn is a compact, swift JavaScript parser, open-source and available under the MIT license. Its primary function is to analyze ECMAScript code and create an abstract syntax tree (AST), complying with the ESTree specification guidelines. Despite its small size, it's potent enough to parse the latest ECMAScript editions and supports various parsing options, providing the user with a customizable yet powerful tool.

How do you use acorn?

You can install and use acorn as an npm package in your project using the following commands to install the package:

npm install acorn

After installing acorn, you can use it in your code as follows:

let acorn = require("acorn");
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));

In the example above, "1 + 1" is a JavaScript expression we're parsing to an AST. The option 'ecmaVersion: 2020' tells acorn to parse the text as per ECMAScript 2020 edition's rules.

Additionally, you can tokenize input strings by leveraging the tokenizer function. Here's a usage example:

for (let token of acorn.tokenizer('1 + 1')) {
  console.log(token);
}

This snippet will display the details of each token identified in the provided string.

Where are the acorn docs?

The documentation for acorn can be found within the source code on the Acorn GitHub repository. The readme file contains details about installation, interface, the parser class, list of available parsing options, command-line interface, plugins information, and more. Although there isn't a separate webpage for 'acorn' documentation, the GitHub repository serves as a comprehensive resource hub for users, with links to bug reports, discussion forums, and related external resources.