Skip to content

Instantly share code, notes, and snippets.

@jixunmoe
Created December 26, 2014 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jixunmoe/d1c21b16ca14cb39fd69 to your computer and use it in GitHub Desktop.
Save jixunmoe/d1c21b16ca14cb39fd69 to your computer and use it in GitHub Desktop.
移除 // 开头的注释
(function (str) {
// 过滤注释
console.info (str.split('\n')
.filter(function (s) { return ! /^\s*\/\//.test(s); })
.join('\n'));
// 空行也会保留
})(require('fs').readFileSync(__filename).toString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment