summaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-15 13:24:59 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-15 13:24:59 -0800
commit8e51ff90c5d6fb2b8c4cec54a77cfd45f7eb8e8f (patch)
tree9c99a8c5542470bb0cd8d17fe02fa04180e47fda /js/lib
parent2ecc11ea86b1d220f8d089a1680307a35437f6ef (diff)
Removed Node.toObject().
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/node.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/js/lib/node.js b/js/lib/node.js
index 9b77e2f..8e424a2 100644
--- a/js/lib/node.js
+++ b/js/lib/node.js
@@ -168,50 +168,6 @@ Node.prototype.walker = function() {
return walker;
};
-var nodeToObject = function(node) {
- var result = {};
- var propsToShow = ['t', 'literal', 'list_data', 'sourcepos',
- 'info', 'level', 'title', 'destination'];
-
- for (var i = 0, len = propsToShow.length; i < len; i++) {
- var prop = propsToShow[i];
- if (node[prop] !== undefined) {
- result[prop] = node[prop];
- }
- }
- return result;
-};
-
-Node.prototype.toObject = function() {
- var childrenStack = [];
- var walker = this.walker();
- var event;
- while ((event = walker.next())) {
- var node = event.node;
- var entering = event.entering;
- var container = node.isContainer();
- var astnode;
-
- if (container) {
- if (entering) {
- childrenStack.push([]);
- } else {
- astnode = nodeToObject(node);
- astnode.children = childrenStack.pop();
- if (childrenStack.length > 0) {
- childrenStack[childrenStack.length - 1].push(astnode);
- }
- }
- } else {
- astnode = nodeToObject(node);
- childrenStack[childrenStack.length - 1].push(astnode);
- }
- }
-
- return astnode;
-
-};
-
module.exports = Node;