{"_id":"messageformat-runtime","_rev":"3-8ef6b3f8d895ae2e405db862b47b90d8","name":"messageformat-runtime","dist-tags":{"next":"3.0.0-beta.1","latest":"3.0.0-beta.1"},"versions":{"3.0.0-beta.0":{"name":"messageformat-runtime","version":"3.0.0-beta.0","description":"Runtime components of messageformat","keywords":["i18n","icu","messageformat","internationalization"],"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","homepage":"https://messageformat.github.io/","repository":{"type":"git","url":"git+https://github.com/messageformat/messageformat.git"},"main":"lib/runtime","sideEffects":false,"scripts":{"build:cjs":"MODULE_TYPE=cjs babel src -d lib","build:mjs":"MODULE_TYPE=mjs babel src -d lib --keep-file-extension","build":"npm run build:cjs && npm run build:mjs","docs":"jsdoc2md -c jsdoc.config.json -f src/messages.mjs > README.md","prepublishOnly":"npm run build && npm run docs"},"dependencies":{"make-plural":"^6.0.0-beta.3"},"browserslist":["last 1 version","> 1%","maintained node versions","not dead"],"eslintConfig":{"env":{"browser":true,"es6":true},"parserOptions":{"sourceType":"module"}},"gitHead":"b154a6f0d58e133a61fa6c5aa0bec51e08e98be7","bugs":{"url":"https://github.com/messageformat/messageformat/issues"},"_id":"messageformat-runtime@3.0.0-beta.0","_nodeVersion":"10.16.3","_npmVersion":"lerna/3.17.0/node@v10.16.3+x64 (darwin)","dist":{"integrity":"sha512-EsdBnUUKX5XFoOhi65uU46UhrwEdsGlja012PGryiSC6kjcZTKx5kMlzMFI31FC+a3gIfGjE4VoAxSwEMNJ13Q==","shasum":"3cde9405de1f94585b7183cda67c30ad9874166f","tarball":"https://registry.npmjs.org/messageformat-runtime/-/messageformat-runtime-3.0.0-beta.0.tgz","fileCount":24,"unpackedSize":31367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpgv5CRA9TVsSAnZWagAAJmwP/Ali3aFdsXtbCGjQ/ran\nzTOC5gmbuRxceS4vRJjMKGJu1vmjRz1wRRwqzBrYnjEe/biKXjNf3zZRjXmf\nha2le5zoP/J0fJ/gcrLpMjJFO8yuqWEv5jMsS1Kkk1geAwMhtOt61iAcKZBo\nATaQC0CiqySH6m1EN23NZKmzrmcpgjB5aqTTqtTsnKE9Glp3eItohSDHtqxJ\n7B+oQPExq7A33yULf/akF57fvVvN6UKqW77lnij2bPkQVd5XrQxleR70m4Ck\nCfthfhKY3MTOEHusFWZ3ISx/zTgbjRKIycpZCAZlzurBuCwxa/xfe7jD+kvw\nhbMJexqBE9XZkiMbzkIC/j2GZIk8icyAvNfTAjz/a9UsBSDifdEnYy3Vy90x\ncUgqzyraAwN4hhPJzfGHqc+hggFSyDAayvnNri8x2tr6lHJPnQZT5Dp4xbTW\noYHIaLUO8U51AXyKV4+G264wTmUtT7z8Y92p94TOC0N+mS4PHfV8WBprGM0l\nnQMc739OadwcGb4U1+V3OXawwUHY3A7bqB0MJQe+6fP4HW59D99hZoT4bvi4\nRPReeHTBdspbVOfD6dbaeyzIg1+MeVJcukGG9RobrL/5MUnvJiZQT9CSOdir\ntIkJSNPj+NPRVeYSPjUPSVCOSX1yuB+JhzbmsDygBWVHosu52gowdT/8HYN7\n0Flv\r\n=ykhF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdCqvOmH9DTUTl7cv4uro0t7Y/AH97Sg5mpa4Xr4YTXwIgSKeUi318Eg9URsRbdbh9bw7h0QgUe1Nw7wpiwXX2tqw="}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/messageformat-runtime_3.0.0-beta.0_1571163129126_0.03355476491943166"},"_hasShrinkwrap":false},"3.0.0-beta.1":{"name":"messageformat-runtime","version":"3.0.0-beta.1","description":"Runtime components of messageformat","keywords":["i18n","icu","messageformat","internationalization"],"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","homepage":"https://messageformat.github.io/messageformat/v3/","repository":{"type":"git","url":"git+https://github.com/messageformat/messageformat.git","directory":"packages/runtime"},"main":"lib/runtime","sideEffects":false,"scripts":{"build:cjs":"MODULE_TYPE=cjs babel src -d lib","build:mjs":"MODULE_TYPE=mjs babel src -d lib --keep-file-extension","build":"npm run build:cjs && npm run build:mjs","docs":"jsdoc2md -c jsdoc.config.json -f src/messages.mjs > README.md","prepublishOnly":"npm run build && npm run docs"},"dependencies":{"make-plural":"^6.2.1"},"browserslist":["last 1 version","> 1%","maintained node versions","not dead"],"eslintConfig":{"env":{"browser":true,"es6":true},"parserOptions":{"sourceType":"module"}},"gitHead":"dd10833d8d39155b005ea2ba6ec7a87f4daf0cd2","readme":"<a name=\"module_messageformat-runtime/messages\"></a>\n\n## messageformat-runtime/messages\nAccessor class for compiled message functions generated by [messageformat](https://www.npmjs.com/package/messageformat)\n\n```js\nimport Messages from 'messageformat-runtime/messages'\n```\n\n\n* [messageformat-runtime/messages](#module_messageformat-runtime/messages)\n    * [module.exports](#exp_module_messageformat-runtime/messages--module.exports) ⏏\n        * [new module.exports(msgData, [defaultLocale])](#new_module_messageformat-runtime/messages--module.exports_new)\n        * [.availableLocales](#module_messageformat-runtime/messages--module.exports+availableLocales) : <code>Array.&lt;string&gt;</code>\n        * [.locale](#module_messageformat-runtime/messages--module.exports+locale) : <code>string</code> \\| <code>null</code>\n        * [.defaultLocale](#module_messageformat-runtime/messages--module.exports+defaultLocale) : <code>string</code> \\| <code>null</code>\n        * [.addMessages(data, [lc], [keypath])](#module_messageformat-runtime/messages--module.exports+addMessages) ⇒ <code>Messages</code>\n        * [.resolveLocale(lc)](#module_messageformat-runtime/messages--module.exports+resolveLocale) ⇒ <code>string</code> \\| <code>null</code>\n        * [.getFallback([lc])](#module_messageformat-runtime/messages--module.exports+getFallback) ⇒ <code>Array.&lt;string&gt;</code>\n        * [.setFallback(lc, fallback)](#module_messageformat-runtime/messages--module.exports+setFallback) ⇒ <code>Messages</code>\n        * [.hasMessage(key, [lc], [fallback])](#module_messageformat-runtime/messages--module.exports+hasMessage) ⇒ <code>boolean</code>\n        * [.hasObject(key, [lc], [fallback])](#module_messageformat-runtime/messages--module.exports+hasObject) ⇒ <code>boolean</code>\n        * [.get(key, [props], [lc])](#module_messageformat-runtime/messages--module.exports+get) ⇒ <code>string</code> \\| <code>Object.&lt;string, (function()\\|object)&gt;</code>\n\n<a name=\"exp_module_messageformat-runtime/messages--module.exports\"></a>\n\n### module.exports ⏏\n**Kind**: Exported class  \n<a name=\"new_module_messageformat-runtime/messages--module.exports_new\"></a>\n\n#### new module.exports(msgData, [defaultLocale])\n\n| Param | Type | Description |\n| --- | --- | --- |\n| msgData | <code>object</code> | A map of locale codes to their function objects |\n| [defaultLocale] | <code>string</code> | If not defined, default and initial locale is the first entry of `locales` |\n\n**Example**  \n```js\n// build.js\nimport fs from 'fs';\nimport MessageFormat from 'messageformat';\n\nconst mf = new MessageFormat(['en', 'fi']);\nconst msgSet = {\n  en: {\n    a: 'A {TYPE} example.',\n    b: 'This has {COUNT, plural, one{one user} other{# users}}.',\n    c: {\n      d: 'We have {P, number, percent} code coverage.'\n    }\n  },\n  fi: {\n    b: 'Tällä on {COUNT, plural, one{yksi käyttäjä} other{# käyttäjää}}.',\n    e: 'Minä puhun vain suomea.'\n  }\n};\nfs.writeFileSync('messages.js', String(mf.compile(msgSet)));\n```\n\n```js\n// runtime.js\nimport Messages from 'messageformat-runtime/messages';\nimport msgData from './messages';\n\nconst messages = new Messages(msgData, 'en');\n\nmessages.hasMessage('a')                // true\nmessages.hasObject('c')                 // true\nmessages.get('b', { COUNT: 3 })         // 'This has 3 users.'\nmessages.get(['c', 'd'], { P: 0.314 })  // 'We have 31% code coverage.'\n\nmessages.get('e')                       // 'e'\nmessages.setFallback('en', ['foo', 'fi'])\nmessages.get('e')                       // 'Minä puhun vain suomea.'\n\nmessages.locale = 'fi'\nmessages.hasMessage('a')                // false\nmessages.hasMessage('a', 'en')          // true\nmessages.hasMessage('a', null, true)    // true\nmessages.hasObject('c')                 // false\nmessages.get('b', { COUNT: 3 })         // 'Tällä on 3 käyttäjää.'\nmessages.get('c').d({ P: 0.628 })       // 'We have 63% code coverage.'\n```\n<a name=\"module_messageformat-runtime/messages--module.exports+availableLocales\"></a>\n\n#### module.exports.availableLocales : <code>Array.&lt;string&gt;</code>\nList of available locales\n\n**Kind**: instance property of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n**Read only**: true  \n<a name=\"module_messageformat-runtime/messages--module.exports+locale\"></a>\n\n#### module.exports.locale : <code>string</code> \\| <code>null</code>\nCurrent locale\n\nOne of Messages#availableLocales or `null`. Partial matches of language tags\nare supported, so e.g. with an `en` locale defined, it will be selected by\n`messages.locale = 'en-US'` and vice versa.\n\n**Kind**: instance property of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n<a name=\"module_messageformat-runtime/messages--module.exports+defaultLocale\"></a>\n\n#### module.exports.defaultLocale : <code>string</code> \\| <code>null</code>\nDefault fallback locale\n\nOne of Messages#availableLocales or `null`. Partial matches of language tags\nare supported, so e.g. with an `en` locale defined, it will be selected by\n`messages.defaultLocale = 'en-US'` and vice versa.\n\n**Kind**: instance property of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n<a name=\"module_messageformat-runtime/messages--module.exports+addMessages\"></a>\n\n#### module.exports.addMessages(data, [lc], [keypath]) ⇒ <code>Messages</code>\nAdd new messages to the accessor; useful if loading data dynamically\n\nThe locale code `lc` should be an exact match for the locale being updated,\nor empty to default to the current locale. Use [#resolveLocale](#resolveLocale) for\nresolving partial locale strings.\n\nIf `keypath` is empty, adds or sets the complete message object for the\ncorresponding locale. If any keys in `keypath` do not exist, a new object\nwill be created at that key.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n**Returns**: <code>Messages</code> - The Messages instance, to allow for chaining  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| data | <code>function</code> \\| <code>object</code> | Hierarchical map of keys to functions, or a   single message function |\n| [lc] | <code>string</code> | If empty or undefined, defaults to `this.locale` |\n| [keypath] | <code>Array.&lt;string&gt;</code> | The keypath being added |\n\n<a name=\"module_messageformat-runtime/messages--module.exports+resolveLocale\"></a>\n\n#### module.exports.resolveLocale(lc) ⇒ <code>string</code> \\| <code>null</code>\nResolve `lc` to the key of an available locale or `null`, allowing for\npartial matches. For example, with an `en` locale defined, it will be\nselected by `messages.defaultLocale = 'en-US'` and vice versa.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| lc | <code>string</code> | Locale code |\n\n<a name=\"module_messageformat-runtime/messages--module.exports+getFallback\"></a>\n\n#### module.exports.getFallback([lc]) ⇒ <code>Array.&lt;string&gt;</code>\nGet the list of fallback locales\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [lc] | <code>string</code> | If empty or undefined, defaults to `this.locale` |\n\n<a name=\"module_messageformat-runtime/messages--module.exports+setFallback\"></a>\n\n#### module.exports.setFallback(lc, fallback) ⇒ <code>Messages</code>\nSet the fallback locale or locales for `lc`\n\nTo disable fallback for the locale, use `setFallback(lc, [])`.\nTo use the default fallback, use `setFallback(lc, null)`.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n**Returns**: <code>Messages</code> - The Messages instance, to allow for chaining  \n\n| Param | Type |\n| --- | --- |\n| lc | <code>string</code> | \n| fallback | <code>Array.&lt;string&gt;</code> \\| <code>null</code> | \n\n<a name=\"module_messageformat-runtime/messages--module.exports+hasMessage\"></a>\n\n#### module.exports.hasMessage(key, [lc], [fallback]) ⇒ <code>boolean</code>\nCheck if `key` is a message function for the locale\n\n`key` may be a `string` for functions at the root level, or `string[]` for\naccessing hierarchical objects. If an exact match is not found and `fallback`\nis true, the fallback locales are checked for the first match.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> \\| <code>Array.&lt;string&gt;</code> |  | The key or keypath being sought |\n| [lc] | <code>string</code> |  | If empty or undefined, defaults to `this.locale` |\n| [fallback] | <code>boolean</code> | <code>false</code> | If true, also checks fallback locales |\n\n<a name=\"module_messageformat-runtime/messages--module.exports+hasObject\"></a>\n\n#### module.exports.hasObject(key, [lc], [fallback]) ⇒ <code>boolean</code>\nCheck if `key` is a message object for the locale\n\n`key` may be a `string` for functions at the root level, or `string[]` for\naccessing hierarchical objects. If an exact match is not found and `fallback`\nis true, the fallback locales are checked for the first match.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> \\| <code>Array.&lt;string&gt;</code> |  | The key or keypath being sought |\n| [lc] | <code>string</code> |  | If empty or undefined, defaults to `this.locale` |\n| [fallback] | <code>boolean</code> | <code>false</code> | If true, also checks fallback locales |\n\n<a name=\"module_messageformat-runtime/messages--module.exports+get\"></a>\n\n#### module.exports.get(key, [props], [lc]) ⇒ <code>string</code> \\| <code>Object.&lt;string, (function()\\|object)&gt;</code>\nGet the message or object corresponding to `key`\n\n`key` may be a `string` for functions at the root level, or `string[]` for\naccessing hierarchical objects. If an exact match is not found, the fallback\nlocales are checked for the first match.\n\nIf `key` maps to a message function, it will be called with `props`. If it\nmaps to an object, the object is returned directly.\n\n**Kind**: instance method of [<code>module.exports</code>](#exp_module_messageformat-runtime/messages--module.exports)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> \\| <code>Array.&lt;string&gt;</code> | The key or keypath being sought |\n| [props] | <code>object</code> | Optional properties passed to the function |\n| [lc] | <code>string</code> | If empty or undefined, defaults to `this.locale` |\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/messageformat/messageformat/issues"},"_id":"messageformat-runtime@3.0.0-beta.1","_nodeVersion":"13.10.1","_npmVersion":"lerna/3.20.2/node@v13.10.1+x64 (darwin)","dist":{"integrity":"sha512-Zr2gv2KogduIp0X5tLrkqHTC9hNwMH71y1d7ZMC9SyEsWEtGe1siFv/5aGxun+unKWXPvpeZWWNUktd5yLFCaw==","shasum":"fdfe1abcf1e298fb8c99b68cc1a1c4d822fde4e2","tarball":"https://registry.npmjs.org/messageformat-runtime/-/messageformat-runtime-3.0.0-beta.1.tgz","fileCount":25,"unpackedSize":33816,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekxMsCRA9TVsSAnZWagAAaNAP+wfesXEYictHVYTtEMTK\nojEHa08hN+zjl2zOh3ghZgNpMw4BKYOjEN/gRBsyLNKxfESGSrnAZczDMuBt\nxOmFpPmyN/WU5D0iSQLgUzdmdwlmoSdnBnPZwj8lupxX83HaFixxmC19GGDR\nBaCogWoeOrrI4rBnKs/KDMapqG904sDQRdOiPUjNNTKVu86I8vaCyKQjWE9h\nJOJSMZE3633is+k2k4hCl5G8UdKoL0xPbGjUwexvhsAPzXCPT0OtUJ//OW5M\n6svg8aJrQGNiiSLI7DcYnsHR3Oc2T+syuN6ipMuvqinDH9l9efVtDjAPIDna\nXDeGs/6QDJkOsUqCziUr2vordEAL6jOs7aKxJ8DbN5yi6SluJiHQxlRW8+Rd\nmxAnVxheyuYP3KtrRh49UhXibc9SGr/+nZqz90ojKkIpooyqo1KOffTjwOYZ\ny/Aw1WQMQJl5MUDVmHNYE8PJXGEhCPf++Sfb0xdkIczmXGjUXr7KDyxJPncU\nBr8slDW6Tyesod/QYKh8TdO90lUoc3k+I3jwyngIsGr8L/YzVwtPz3cfgalH\nNaBEvpVwixiB5WfnYj5QWHb4dDKavMKW2Bm+s/MrtoU2qS9N5J2Hi8cS4pls\neeaGcK4QzsSlK2y5FVPzBFIbor+d4axfYuiyvN3P9szVCtlB+uwUygNb6fz7\n3hJd\r\n=6Zhv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpXUJ4WSJrYEZcU7RXVPkAIYimhsHgq+8CZFg2ZoskLgIhAMUVeBwKMph3W6O5Ho0oTCkRpcSElIRxVaxo/n7pt99F"}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/messageformat-runtime_3.0.0-beta.1_1586697004097_0.1919114374972153"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-15T18:12:08.893Z","3.0.0-beta.0":"2019-10-15T18:12:09.233Z","modified":"2022-05-09T04:50:10.205Z","3.0.0-beta.1":"2020-04-12T13:10:04.300Z"},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"description":"Runtime components of messageformat","homepage":"https://messageformat.github.io/","keywords":["i18n","icu","messageformat","internationalization"],"repository":{"type":"git","url":"git+https://github.com/messageformat/messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"bugs":{"url":"https://github.com/messageformat/messageformat/issues"},"license":"MIT","readme":"","readmeFilename":""}