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

Method hasMessage

packages/runtime/src/messages.mjs:231–235  ·  view source on GitHub ↗

* Check if `key` is a message function for the locale * * `key` may be a `string` for functions at the root level, or `string[]` for * accessing hierarchical objects. If an exact match is not found and `fallback` * is true, the fallback locales are checked for the first match. * *

(key, lc, fallback)

Source from the content-addressed store, hash-verified

229 * @returns {boolean}
230 */
231 hasMessage(key, lc, fallback) {
232 if (!lc) lc = this.locale;
233 const fb = fallback ? this.getFallback(lc) : null;
234 return _has(this._data, lc, key, fb, 'function');
235 }
236
237 /**
238 * Check if `key` is a message object for the locale

Callers 1

messages.jsFile · 0.80

Calls 2

getFallbackMethod · 0.95
_hasFunction · 0.85

Tested by

no test coverage detected