(token, pluralToken)
| 69 | } |
| 70 | |
| 71 | cases(token, pluralToken) { |
| 72 | let needOther = true; |
| 73 | const r = token.cases.map(({ key, tokens }) => { |
| 74 | if (key === 'other') needOther = false; |
| 75 | const s = tokens.map(tok => this.token(tok, pluralToken)); |
| 76 | return `${property(null, key)}: ${this.concatenate(s, false)}`; |
| 77 | }); |
| 78 | if (needOther) { |
| 79 | const { type } = token; |
| 80 | const { cardinals, ordinals } = this.plural; |
| 81 | if ( |
| 82 | type === 'select' || |
| 83 | (type === 'plural' && cardinals.includes('other')) || |
| 84 | (type === 'selectordinal' && ordinals.includes('other')) |
| 85 | ) |
| 86 | throw new Error(`No 'other' form found in ${JSON.stringify(token)}`); |
| 87 | } |
| 88 | return `{ ${r.join(', ')} }`; |
| 89 | } |
| 90 | |
| 91 | concatenate(tokens, root) { |
| 92 | const asValues = this.options.returnType === 'values'; |
no test coverage detected