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