[Pkg-javascript-commits] [node-astw] 23/30: ecma version 8

Bastien Roucariès rouca at moszumanska.debian.org
Tue Sep 26 12:55:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-astw.

commit d4ea6a424de7cb62d0c527d5574a9c9ebe57d634
Author: substack <substack at 9nTgtYmvW4HID6ayt6Icwc8WZxdifx5SlSKKIX/X/1g=.ed25519>
Date:   Wed Mar 1 12:47:07 2017 -1000

    ecma version 8
---
 index.js        | 5 +++--
 readme.markdown | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 8e34110..99bf5c6 100644
--- a/index.js
+++ b/index.js
@@ -1,11 +1,12 @@
 var parse = require('acorn').parse;
 
-module.exports = function (src) {
+module.exports = function (src, opts) {
+    if (!opts) opts = {}
     var ast = src;
     if (typeof src === 'string') {
         try {
             ast = parse(src, {
-                ecmaVersion: 6,
+                ecmaVersion: opts.ecmaVersion || 8,
                 allowReturnOutsideFunction: true
             })
         }
diff --git a/readme.markdown b/readme.markdown
index 807b5ad..b9a7558 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -29,10 +29,14 @@ walk(function (node) {
 var astw = require('astw')
 ```
 
-## var walk = astw(src)
+## var walk = astw(src, opts={})
 
 Return a `walk()` function from the source string or ast object `src`.
 
+Optionally:
+
+* `opts.ecmaVersion` - default: 8
+
 ## walk(cb)
 
 Walk the nodes in the ast with `cb(node)` where `node` is each element in the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-astw.git



More information about the Pkg-javascript-commits mailing list