From 4a851130ee1779655d87d652abccf9068e0958f4 Mon Sep 17 00:00:00 2001 From: James Kyle Date: Sat, 11 Jul 2015 12:03:23 -0700 Subject: [PATCH] Add descriptions to helpers/parse --- src/babel/helpers/parse.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/babel/helpers/parse.js b/src/babel/helpers/parse.js index d6cd6d235a..b54d0054e5 100644 --- a/src/babel/helpers/parse.js +++ b/src/babel/helpers/parse.js @@ -3,7 +3,7 @@ import estraverse from "estraverse"; import * as acorn from "../../acorn"; /** - * [Please add a description.] + * Parse `code` with normalized options, collecting tokens and comments. */ export default function (code, opts = {}) { @@ -25,11 +25,17 @@ export default function (code, opts = {}) { ranges: true }; + /** + * Collect all tokens. + */ parseOpts.onToken = function (token) { tokens.push(token); commentsAndTokens.push(token); }; + /** + * Collection all comments. + */ parseOpts.onComment = function (block, text, start, end, startLoc, endLoc) { var comment = { type: block ? "CommentBlock" : "CommentLine",