parsejs 1.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 48

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.

Use this package as a library

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 flutter 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
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
22
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, other

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

Health suggestions

Format lib/src/ast.dart.

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

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-5 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is getting outdated. (-43.01 points)

The package was released 74 weeks ago.

The description is too short. (-20 points)

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. (-10 points)

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
unicode >=0.0.8 <1.0.0 0.1.0
Transitive dependencies
lists 0.0.23