(messageformat, messages)
| 81 | * messages.b({ COUNT: 3 }) // 'This has 3 members.' |
| 82 | */ |
| 83 | export default function compileModule(messageformat, messages) { |
| 84 | const { plurals } = messageformat; |
| 85 | const cp = {}; |
| 86 | if (plurals.length > 1) |
| 87 | for (const pl of plurals) cp[pl.lc] = cp[pl.locale] = pl; |
| 88 | const compiler = new Compiler(messageformat.options); |
| 89 | const msgObj = compiler.compile(messages, plurals[0], cp); |
| 90 | const msgStr = stringifyObject(msgObj); |
| 91 | const rtStr = stringifyRuntime(compiler.runtime); |
| 92 | return `${rtStr}\nexport default ${msgStr}`; |
| 93 | } |
no test coverage detected