Skip to content

brianmhunt/opine.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opine.js

This converts Javascript inline comments by way of YAML into regularized data that can be used to generate automatic documentation.

Any block comment that starts with --- will be parsed as YAML, with the result added as vars to a result.

For example, given

spec/fixtures/sample-1.js

/*---
  comment: 123
 */
function fn_name() { }


/*---
  trying: something
 */
var x

then running

var opine = require('opine')
opine.rip_file('./spec/fixtures/sample-1.js')

returns something like this:

[ { type: 'function',
    name: 'fn_name',
    source: "./spec/fixtures/sample-1.js",
    line: 2,
    vars: { comment: 123 } },
  { type: 'var',
    name: 'x',
    source: "./spec/fixtures/sample-1.js"
    line: 8,
    vars: { trying: 'something' } }
]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published