Skip to content

Commit

Permalink
Strip inline comments when cleaning javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed May 30, 2017
1 parent b21b01d commit 601938b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fn/compile-app-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ module.exports = (project /*, couchUrl */) => {
};

const simple = s => s.replace(/\..*/, '').replace('-', '_');
const cleanJs = js => js.split('\n').map(s => s.trim().replace(/\s*\/\/.*/, '')).join('');
const cleanJs = js =>
js.split('\n')
.map(s =>
s.trim()
.replace(/\s*\/\/.*/, '') // single-line comments (like this one)
).join('')
.replace(/\s*\/\*(?:(?!\*\/).)*\*\/\s*/g, ''); /* this kind of comment */

0 comments on commit 601938b

Please sign in to comment.