message-format
Advanced tools
Comparing version 6.0.0 to 6.0.3
# Changelog | ||
## 6.0.3 | ||
Use `var` declarations for wider compatibility. | ||
## 6.0.0 | ||
@@ -4,0 +8,0 @@ |
29
index.js
// @flow | ||
'use strict' | ||
const interpret = require('format-message-interpret') | ||
const parse = require('format-message-parse') | ||
const plurals = require('format-message-interpret/plurals') | ||
const supportedExp = new RegExp( | ||
var interpret = require('format-message-interpret') | ||
var parse = require('format-message-parse') | ||
var plurals = require('format-message-interpret/plurals') | ||
var supportedExp = new RegExp( | ||
'^(' + Object.keys(plurals).join('|') + ')\\b' | ||
@@ -26,3 +26,3 @@ ) | ||
const internals/*: WeakMap<MessageFormat, Internals> */ = new WeakMap() | ||
var internals/*: WeakMap<MessageFormat, Internals> */ = new WeakMap() | ||
@@ -42,3 +42,3 @@ /*! | ||
} | ||
const ast = parse(pattern) | ||
var ast = parse(pattern) | ||
internals.set(this, { | ||
@@ -59,3 +59,3 @@ ast: ast, | ||
get: function format () { | ||
const values = internals.get(this) | ||
var values = internals.get(this) | ||
if (!values) throw new TypeError('MessageFormat.prototype.format called on value that\'s not an object initialized as a MessageFormat') | ||
@@ -69,5 +69,5 @@ return values.format | ||
value: function formatToParts (args/*:: ?: Object */) { | ||
const values = internals.get(this) | ||
var values = internals.get(this) | ||
if (!values) throw new TypeError('MessageFormat.prototype.formatToParts called on value that\'s not an object initialized as a MessageFormat') | ||
const frmt = values.toParts || (values.toParts = interpret.toParts( | ||
var frmt = values.toParts || (values.toParts = interpret.toParts( | ||
values.ast, | ||
@@ -84,3 +84,3 @@ values.locales, | ||
value: function resolvedOptions () { | ||
const values = internals.get(this) | ||
var values = internals.get(this) | ||
if (!values) throw new TypeError('MessageFormat.prototype.resolvedOptions called on value that\'s not an object initialized as a MessageFormat') | ||
@@ -107,7 +107,6 @@ return { | ||
Intl.DateTimeFormat.supportedLocalesOf(requestedLocales), | ||
Intl.PluralRules /* istanbul ignore next */ | ||
? Intl.PluralRules.supportedLocalesOf(requestedLocales) | ||
: [].concat(requestedLocales || []).filter(function (locale) { | ||
return supportedExp.test(locale) | ||
}) | ||
Intl.PluralRules ? Intl.PluralRules.supportedLocalesOf(requestedLocales) : [], | ||
[].concat(requestedLocales || []).filter(function (locale) { | ||
return supportedExp.test(locale) | ||
}) | ||
).filter(function (v, i, a) { return a.indexOf(v) === i }) | ||
@@ -114,0 +113,0 @@ } |
{ | ||
"name": "message-format", | ||
"version": "6.0.0", | ||
"version": "6.0.3", | ||
"description": "Intl.MessageFormat prollyfill supporting ICU message format", | ||
@@ -25,5 +25,5 @@ "author": "Andy VanWagoner <andy@thetalecrafter.com> (https://thetalecrafter.com/)", | ||
"dependencies": { | ||
"format-message-interpret": "^6.0.0", | ||
"format-message-parse": "^6.0.0" | ||
"format-message-interpret": "^6.0.3", | ||
"format-message-parse": "^6.0.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103