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

Method get

packages/runtime/src/messages.mjs:270–280  ·  view source on GitHub ↗

* Get the message or object corresponding to `key` * * `key` may be a `string` for functions at the root level, or `string[]` for * accessing hierarchical objects. If an exact match is not found, the fallback * locales are checked for the first match. * * If `key` maps to a message

(key, props, lc)

Source from the content-addressed store, hash-verified

268 * @returns {string|Object<string,function|object>}
269 */
270 get(key, props, lc) {
271 if (!lc) lc = this.locale;
272 let msg = _get(this._data[lc], key);
273 if (msg) return typeof msg == 'function' ? msg(props) : msg;
274 const fb = this.getFallback(lc);
275 for (let i = 0; i < fb.length; ++i) {
276 msg = _get(this._data[fb[i]], key);
277 if (msg) return typeof msg == 'function' ? msg(props) : msg;
278 }
279 return key;
280 }
281}
282
283/** @private */

Callers 15

messages.jsFile · 0.80
lunr.min.jsFile · 0.80
pFunction · 0.80
BFunction · 0.80
GFunction · 0.80
docstrap.lib.jsFile · 0.80
gFunction · 0.80
jquery.min.jsFile · 0.80
htFunction · 0.80
qtFunction · 0.80
DnFunction · 0.80
sFunction · 0.80

Calls 2

getFallbackMethod · 0.95
_getFunction · 0.85

Tested by

no test coverage detected