Created
July 26, 2022 18:34
-
-
Save eidosam/e28c05aec39a6bb07cc82e29a3da71dd to your computer and use it in GitHub Desktop.
This file contains 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
function newlineDelimitedKeyValue(obj, parentKey = '') { | |
return Object.entries(obj) | |
.map(([k, v]) => { | |
if (typeof v === 'object') { | |
return newlineDelimitedKeyValue(v, `${parentKey}${k}_`); | |
} | |
const kUpper = `${parentKey}${k}`.toUpperCase(); | |
return `${kUpper}=${v}`; | |
}) | |
.join('\n'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment