Skip to content

Instantly share code, notes, and snippets.

@jonstuebe
Created April 23, 2019 20:14
Show Gist options
  • Save jonstuebe/af4bba71bb5413a5420035d880103050 to your computer and use it in GitHub Desktop.
Save jonstuebe/af4bba71bb5413a5420035d880103050 to your computer and use it in GitHub Desktop.
const postmanEnv = {
"id": "7a40704a-d4e2-4948-ba35-826a93f2bf0f",
"name": "local",
"values": [
// values would go here
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-04-23T18:36:01.716Z",
"_postman_exported_using": "Postman/7.0.9"
};
const env = postmanEnv.values.reduce((acc, {key, value}) => {
if(acc.value) {
return { [key]: value };
}
return { ...acc, [key]: value }
});
console.log(JSON.stringify(env));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment