Skip to content

Instantly share code, notes, and snippets.

@solarsailer
Created February 6, 2012 20:44
Show Gist options
  • Save solarsailer/1754721 to your computer and use it in GitHub Desktop.
Save solarsailer/1754721 to your computer and use it in GitHub Desktop.
Simple doc parser
fs = require 'fs'
path = 'some_path.js'
fs.readFile path, 'utf-8', (err, data) ->
data.split('\n').forEach (line) ->
if line.indexOf('*') != -1
line = clean line
console.log line if line != ''
clean = (line) ->
line = line.replace('/*', '')
line = line.replace('/**', '')
line = line.replace('*/', '')
line = line.replace('*', '')
line = line.trim()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment