MCPcopy Index your code
hub / github.com/messageformat/messageformat / compileModule

Function compileModule

packages/messageformat/src/compile-module.js:83–93  ·  view source on GitHub ↗
(messageformat, messages)

Source from the content-addressed store, hash-verified

81 * messages.b({ COUNT: 3 }) // 'This has 3 members.'
82 */
83export 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}

Callers 4

cli.jsFile · 0.85
index.jsFile · 0.85
getModuleFunction · 0.85
build-module.jsFile · 0.85

Calls 3

compileMethod · 0.95
stringifyObjectFunction · 0.85
stringifyRuntimeFunction · 0.85

Tested by

no test coverage detected