parsejs 1.2.0

  • Installing
  • Versions
  • 63


ParseJS is a JavaScript parser for Dart. It is well-tested and is reasonably efficient.

Example Usage

import 'package:parsejs/parsejs.dart';

void main() {
    new File('test.js').readAsString().then((String code) {
        Program ast = parsejs(code, filename: 'test.js')
        // Use the AST for something


The parsejs function takes the following optional arguments:

  • filename: An arbitrary string indicating where the source came from. For your convenience this will be available on Node.filename and on ParseError.filename.
  • firstLine: The line number to associate with the first line of code. Default is 1. Useful if code was extracted from an HTML file, and you prefer absolute line numbers.
  • handleNoise: If true, parser will try to ignore hash bangs and HTML comment tags surrounding the source code. Default is true.
  • annotate: If true, parser will initialize Node.parent, Scope.environment, and Name.scope, to simplify subsequent AST analysis. Default is true.
  • parseAsExpression: If true, the input will be parsed as an expression statement.

1.2.0 (2017-05-06)

  • Added an option to parse the input as an expression.

1.1.0 (2015-06-01)

  • Added visitor with one argument.

1.0.0 - 1.0.3

  • Initial version with some bugfixes releases.

1. Depend on it

Add this to your package's pubspec.yaml file:

  parsejs: "^1.2.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:parsejs/parsejs.dart';
Version Uploaded Documentation Archive
1.2.0 May 6, 2017 Go to the documentation of parsejs 1.2.0 Download parsejs 1.2.0 archive
1.1.0 Jun 1, 2015 Go to the documentation of parsejs 1.1.0 Download parsejs 1.1.0 archive
1.0.3 Dec 17, 2014 Go to the documentation of parsejs 1.0.3 Download parsejs 1.0.3 archive
1.0.2 Nov 24, 2014 Go to the documentation of parsejs 1.0.2 Download parsejs 1.0.2 archive
1.0.1 Nov 24, 2014 Go to the documentation of parsejs 1.0.1 Download parsejs 1.0.1 archive
1.0.0 Nov 24, 2014 Go to the documentation of parsejs 1.0.0 Download parsejs 1.0.0 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
27 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, other

Primary library: package:parsejs/parsejs.dart with components: io.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use parsejs.dart.


Package Constraint Resolved Available
Direct dependencies
unicode >=0.0.8 <1.0.0 0.0.10
Transitive dependencies
lists 0.0.22