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

Method setFormatter

packages/messageformat/src/compiler.js:224–240  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

222 }
223
224 setFormatter(key) {
225 if (this.runtimeIncludes(key, 'formatter')) return;
226 const cf = this.options.customFormatters[key];
227 if (cf) {
228 cf.type = 'formatter';
229 this.runtime[key] = cf;
230 } else {
231 const df = Formatters[key];
232 if (df) {
233 df.module = FORMATTER_MODULE;
234 df.type = 'formatter';
235 this.runtime[key] = df;
236 } else {
237 throw new Error(`Formatting function not found: ${key}`);
238 }
239 }
240 }
241
242 setDateFormatter({ param }, args, plural) {
243 const { locale } = this.plural;

Callers 3

tokenMethod · 0.95
setDateFormatterMethod · 0.95
setNumberFormatterMethod · 0.95

Calls 1

runtimeIncludesMethod · 0.95

Tested by

no test coverage detected