[Pkg-javascript-commits] [node-astw] 03/30: types example
Bastien Roucariès
rouca at moszumanska.debian.org
Tue Sep 26 12:55:03 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 272a2c0d8e1867478dadd4bc4fb8c69454915d10
Author: James Halliday <mail at substack.net>
Date: Sat Mar 2 02:18:45 2013 -0800
types example
---
example/types.js | 8 ++++++++
test/parent.js | 3 +--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/example/types.js b/example/types.js
new file mode 100644
index 0000000..08cbe28
--- /dev/null
+++ b/example/types.js
@@ -0,0 +1,8 @@
+var astw = require('../');
+var deparse = require('escodegen').generate;
+var walk = astw('4 + beep(5 * 2)');
+
+walk(function (node) {
+ var src = deparse(node);
+ console.log(node.type + ' :: ' + JSON.stringify(src));
+});
diff --git a/test/parent.js b/test/parent.js
index 26e2011..a7403d3 100644
--- a/test/parent.js
+++ b/test/parent.js
@@ -19,8 +19,7 @@ test('parent', function (t) {
t.equal(node.parent.type, 'VariableDeclarator');
t.equal(unparse(node.parent), 'xs=[1,2,3]');
t.equal(node.parent.parent.type, 'VariableDeclaration');
- t.equal(unparse(node.parent.parent), 'var xs=[1,2,3];'
- );
+ t.equal(unparse(node.parent.parent), 'var xs=[1,2,3];');
}
});
});
--
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