parsejs 1.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 60

ParseJS

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
    })
}

Options

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:


dependencies:
  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

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
20 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
60
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:parsejs/parsejs.dart.

Suggestions

  • 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.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run dartfmt to format lib/src/ast.dart.

Dependencies

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