UNPKG

translate-maker

Version:

Lightweight translation module. Internationalize your great project.

27 lines (22 loc) 583 B
import find from 'lodash/find'; export default function select(value, part, attrs, metadata, ...args) { let defaultOption = null; const option = find(args, arg => { if (arg.type !== 'pair') { return false; } if (!arg.key || arg.key === 'other') { defaultOption = arg; return false; } return arg.key === value; }); if (option) { return this.buildText(option.value, attrs, value); } if (defaultOption) { return this.buildText(defaultOption.value, attrs, value); } return undefined; } //# sourceMappingURL=select.js.map