Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acorn-es7

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn-es7

ES7 decorators support for Acorn.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8K
increased by17.16%
Maintainers
1
Weekly downloads
 
Created
Source

acorn-es7

ES7 support for Acorn. It works with node.js and plain browser:

** decorators: ** works with acorn and acorn loose parser. ** provides a walk ** async/await ** see acorn-es7-plugin

Usage

See sample.js:

// Require acorn as usual
var acorn = require("acorn");
// Add the es7-plugin
require('./acorn-es7')(acorn) ;

var code = "@Component()\n class AppComponent{}"; 
var ast = acorn.parse(code,{
    // Specify use of the plugin
    plugins:{es7:true},
    // Specify the ecmaVersion
    ecmaVersion:7
}) ;
// Show the AST
console.log(JSON.stringify(ast, null, 1)) ;
@Component()
class AppComponent{}
{
 "type": "Program",
 "start": 0,
 "end": 34,
 "body": [
  {
   "type": "ClassDeclaration",
   "start": 0,
   "end": 34,
   "id": {
    "type": "Identifier",
    "start": 20,
    "end": 32,
    "name": "AppComponent"
   },
   "superClass": null,
   "body": {
    "type": "ClassBody",
    "start": 32,
    "end": 34,
    "body": []
   },
   "decorators": [
    {
     "type": "Decorator",
     "start": 0,
     "end": 12,
     "expression": {
      "type": "CallExpression",
      "start": 1,
      "end": 12,
      "callee": {
       "type": "Identifier",
       "start": 1,
       "end": 10,
       "name": "Component"
      },
      "arguments": []
     }
    }
   ]
  }
 ],
 "sourceType": "script"
}

Keywords

FAQs

Package last updated on 09 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc