Skip to content

Commit

Permalink
Fixed extra characters when parsing comments rows
Browse files Browse the repository at this point in the history
  • Loading branch information
devdevdenis committed Oct 29, 2021
1 parent f3eda19 commit 3261f75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ const recursiveReadDir = require('recursive-readdir')

function parseComments(file) {
const lines = file.split('\n'), require = []
const extraCharactersRegexp = new RegExp(/[\r\n]/)
let i = 0, dropCode = ''

while(lines[i].startsWith('--') || lines[i].trim() === '') {
if (lines[i].startsWith('-- drop-code')) {
dropCode = lines[i].slice(13)
dropCode = lines[i].slice(13).replace(extraCharactersRegexp, '')
}

if (lines[i].startsWith('-- require')) {
require.push(lines[i].slice(11))
require.push(lines[i].slice(11).replace(extraCharactersRegexp, ''))
}

i++
Expand Down

0 comments on commit 3261f75

Please sign in to comment.