Skip to content

Commit

Permalink
Merge pull request #404 from wffranco/patch-3
Browse files Browse the repository at this point in the history
Support empty lines and comments.
  • Loading branch information
motdotla committed Jan 16, 2022
2 parents 33b81a6 + 4b956d4 commit 02c581d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/main.js
Expand Up @@ -18,6 +18,13 @@ function parse (src, options) {

// convert Buffers before splitting into lines and processing
src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
line = line.trim()

// ignore empty and commented lines
if (line === '' || line[0] === '#') {
return
}

// matching "KEY' and 'VAL' in 'KEY=VAL'
const keyValueArr = line.match(RE_INI_KEY_VAL)
// matched?
Expand Down

0 comments on commit 02c581d

Please sign in to comment.