process.env['CONTRACTS_VERSION']; const isDev = process.env['NODE_ENV'] !== 'production'; const prefix = isDev ? `/${network}/contracts/` : `https://prod.test.com/${network}/contracts/${version}/`; return [prefix, contract, '.json'].join(''); } const fetchContract = c \> fetch(contractUrl(c)).then(r \> r.json()); const contracts = ['SomeToken', 'OtherToken', 'FooToken', 'BarToken']; export function getContract() { return Promise.all(contracts.map(fetchContract)).then( ([SomeToken, OtherToken, FooToken, BarToken]) \> ({ SomeToken, OtherToken, FooToken, BarToken, }), ); }