Skip to content

Commit

Permalink
filter out comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed May 7, 2017
1 parent 3fc6cd5 commit f2ef42e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ function stringToObject (string, value, index = 0, acc = {}, root = acc) {

function parseCompose (compose) {
const regex = /^\s*"?((?:[^"]|\\\")+)"?:\s+(.*)$/
const comment = '#'
const insertText = 'insertText:'
const entries = compose
.split('\n')
.filter(entry => entry[0] !== comment)
.map(entry => regex.exec(entry))
.filter(Boolean)
.reduce((acc, [_, key, value]) => {
Expand Down

0 comments on commit f2ef42e

Please sign in to comment.