Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Created November 8, 2019 22:58
Show Gist options
  • Save brunoluiz/b8ca5236ff6a095801422604d68d6e30 to your computer and use it in GitHub Desktop.
Save brunoluiz/b8ca5236ff6a095801422604d68d6e30 to your computer and use it in GitHub Desktop.
const matcher = /^(CONFIG_|REACT_APP).*$/g;
const replacer = /(CONFIG_|REACT_APP)/g;
const pconfigs = Object.keys(process.env).reduce((acc, key) => {
if (!key.match(matcher)) {
return acc;
}
const k = key.replace(replacer, '');
return { ...acc, [k]: process.env[key] };
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment