UNPKG

dvf-client-js

Version:

<img src="https://avatars1.githubusercontent.com/u/56512535?s=200&v=4" align="right" />

18 lines (13 loc) 407 B
const DVFError = require('../DVFError') module.exports = (dvf, token) => { const { tokenRegistry } = dvf.config if (!tokenRegistry) { throw new DVFError('NO_TOKEN_REGISTRY') } const tokenInfo = tokenRegistry[token] if (!tokenInfo) { const validTokens = Object.keys(tokenRegistry) throw new DVFError('ERR_INVALID_TOKEN', { token, validTokens }) } return {token, ...tokenInfo} }