Last active
November 22, 2017 14:36
-
-
Save fox1t/1e86e7d5ccfaa9f152e8a16f802f6f84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parse = (env) => | |
env | |
.split(/\r?\n|\r/g) | |
.reduce((obj, line) => { | |
const matched = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/) | |
if (matched != null) { | |
return Object.assign({}, _.set(obj, matched[1].toLowerCase(),matched[2] || '' )) | |
} | |
return obj | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment