UNPKG

b5-result-text

Version:
21 lines (19 loc) 608 B
const getTemplate = require('./get-template') module.exports = options => { if (!options) { throw new Error('Missing required input: options') } if (!options.language) { throw new Error('Missing required input: options.language') } if (!options.domain) { throw new Error('Missing required input: options.domain') } const template = getTemplate(options.language) if (!template) { throw new Error('Template not found') } const domainId = options.domain.toLowerCase() const filtered = template.filter(item => item.domain.toLowerCase() === domainId) return filtered[0] }