1+ 'use strict' ;
2+
13module . exports = doJSON ;
24
35// Take the lexed input, and return a JSON-encoded object
@@ -12,7 +14,7 @@ function doJSON(input, filename, cb) {
1214 var current = root ;
1315 var state = null ;
1416 var lexed = marked . lexer ( input ) ;
15- lexed . forEach ( function ( tok ) {
17+ lexed . forEach ( function ( tok ) {
1618 var type = tok . type ;
1719 var text = tok . text ;
1820
@@ -31,7 +33,7 @@ function doJSON(input, filename, cb) {
3133 if ( type === 'heading' &&
3234 ! text . trim ( ) . match ( / ^ e x a m p l e / i) ) {
3335 if ( tok . depth - depth > 1 ) {
34- return cb ( new Error ( 'Inappropriate heading level\n' +
36+ return cb ( new Error ( 'Inappropriate heading level\n' +
3537 JSON . stringify ( tok ) ) ) ;
3638 }
3739
@@ -77,7 +79,7 @@ function doJSON(input, filename, cb) {
7779 //
7880 // If one of these isnt' found, then anything that comes between
7981 // here and the next heading should be parsed as the desc.
80- var stability
82+ var stability ;
8183 if ( state === 'AFTERHEADING' ) {
8284 if ( type === 'code' &&
8385 ( stability = text . match ( / ^ S t a b i l i t y : ( [ 0 - 5 ] ) (?: \s * - \s * ) ? ( .* ) $ / ) ) ) {
@@ -125,7 +127,7 @@ function doJSON(input, filename, cb) {
125127 finishSection ( current , stack [ stack . length - 1 ] ) ;
126128 }
127129
128- return cb ( null , root )
130+ return cb ( null , root ) ;
129131}
130132
131133
@@ -146,7 +148,7 @@ function doJSON(input, filename, cb) {
146148// { type: 'list_item_end' },
147149// { type: 'list_item_start' },
148150// { type: 'text',
149- // text: 'silent: Boolean, whether or not to send output to parent\'s stdio.' },
151+ // text: 'silent: Boolean, whether to send output to parent\'s stdio.' },
150152// { type: 'text', text: 'Default: `false`' },
151153// { type: 'space' },
152154// { type: 'list_item_end' },
@@ -168,7 +170,7 @@ function doJSON(input, filename, cb) {
168170// desc: 'string arguments passed to worker.' },
169171// { name: 'silent',
170172// type: 'boolean',
171- // desc: 'whether or not to send output to parent\'s stdio.',
173+ // desc: 'whether to send output to parent\'s stdio.',
172174// default: 'false' } ] } ]
173175
174176function processList ( section ) {
@@ -231,7 +233,7 @@ function processList(section) {
231233 // each item is an argument, unless the name is 'return',
232234 // in which case it's the return value.
233235 section . signatures = section . signatures || [ ] ;
234- var sig = { }
236+ var sig = { } ;
235237 section . signatures . push ( sig ) ;
236238 sig . params = values . filter ( function ( v ) {
237239 if ( v . name === 'return' ) {
@@ -273,7 +275,7 @@ function parseSignature(text, sig) {
273275 params = params [ 1 ] ;
274276 // the [ is irrelevant. ] indicates optionalness.
275277 params = params . replace ( / \[ / g, '' ) ;
276- params = params . split ( / , / )
278+ params = params . split ( / , / ) ;
277279 params . forEach ( function ( p , i , _ ) {
278280 p = p . trim ( ) ;
279281 if ( ! p ) return ;
@@ -362,7 +364,7 @@ function parseListItem(item) {
362364
363365function finishSection ( section , parent ) {
364366 if ( ! section || ! parent ) {
365- throw new Error ( 'Invalid finishSection call\n' +
367+ throw new Error ( 'Invalid finishSection call\n' +
366368 JSON . stringify ( section ) + '\n' +
367369 JSON . stringify ( parent ) ) ;
368370 }
@@ -405,7 +407,7 @@ function finishSection(section, parent) {
405407 // properties are a bit special.
406408 // their "type" is the type of object, not "property"
407409 if ( section . properties ) {
408- section . properties . forEach ( function ( p ) {
410+ section . properties . forEach ( function ( p ) {
409411 if ( p . typeof ) p . type = p . typeof ;
410412 else delete p . type ;
411413 delete p . typeof ;
0 commit comments