Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloudflare/intl-core

Package Overview
Dependencies
Maintainers
84
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/intl-core - npm Package Compare versions

Comparing version 1.6.2 to 1.6.3

dist/pseudoloc.d.ts

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

## [1.6.3](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/intl-core@1.6.2...@cloudflare/intl-core@1.6.3) (2021-04-29)
### Bug Fixes
* **intl-core:** UI-4298 fix type error with pseudoloc ([9181723](http://stash.cfops.it:7999/fe/stratus/commits/9181723))
* **intl-core:** UI-4298 include [@types](http://stash.cfops.it:7999/types)/node-polyglot in deps ([be2d2e4](http://stash.cfops.it:7999/fe/stratus/commits/be2d2e4))
* **intl-core:** UI-4298 vendor pseudoloc lib ([4dd2824](http://stash.cfops.it:7999/fe/stratus/commits/4dd2824))
## [1.6.2](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/intl-core@1.6.1...@cloudflare/intl-core@1.6.2) (2021-04-23)

@@ -8,0 +21,0 @@

45

es/Interpolation.js

@@ -1,15 +0,5 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export var Interpolation =
/*#__PURE__*/
function () {
function Interpolation(value, keys) {
_classCallCheck(this, Interpolation);
export class Interpolation {
constructor(value, keys) {
_defineProperty(this, "value", void 0);

@@ -23,27 +13,18 @@

_createClass(Interpolation, [{
key: "toString",
value: function toString() {
return this.value;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.value;
}
}]);
toString() {
return this.value;
}
return Interpolation;
}();
export function trans(strings) {
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
keys[_key - 1] = arguments[_key];
toJSON() {
return this.value;
}
var string = strings.reduce(function (accum, str, i) {
var result = accum + str;
var paramName = keys[i];
}
export function trans(strings, ...keys) {
const string = strings.reduce((accum, str, i) => {
let result = accum + str;
const paramName = keys[i];
if (typeof paramName === 'string') {
result += "%{".concat(paramName, "}");
result += `%{${paramName}}`;
}

@@ -50,0 +31,0 @@

@@ -1,58 +0,30 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { SupportedLocales } from './index';
var loadLocale =
/*#__PURE__*/
function () {
var _ref = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(locales, locale) {
var module;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return locales[locale]();
const loadLocale = async (locales, locale) => {
const module = await locales[locale]();
case 2:
module = _context.sent;
if (module.translations) {
return module.translations;
} // with weback 4.0 the module is loaded into the default attr
// in older versions it is not
if (!module.translations) {
_context.next = 5;
break;
}
return _context.abrupt("return", module.translations);
case 5:
return _context.abrupt("return", module.default ? module.default : module);
case 6:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return function loadLocale(_x, _x2) {
return _ref.apply(this, arguments);
};
}(); //returns a function which returns a Promise resolving in phrases for a particular locale.
return module.default ? module.default : module;
}; //returns a function which returns a Promise resolving in phrases for a particular locale.
//loads english catalog by default and overwrites it with catalog in target language.

@@ -62,46 +34,18 @@ //so that for any phrases for which target language catalog is missing a value, the english one is used.

var makeLoadPhrases = function loadPhrases(locales) {
var loadPhrases =
/*#__PURE__*/
function () {
var _ref2 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(locale) {
var _ref3, _ref4, enPhrases, otherPhrases;
const makeLoadPhrases = function loadPhrases(locales) {
const loadPhrases = async locale => {
if (locale === SupportedLocales.en_US) {
return loadLocale(locales, locale);
}
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(locale === SupportedLocales.en_US)) {
_context2.next = 2;
break;
}
const _await$Promise$all = await Promise.all([loadLocale(locales, SupportedLocales.en_US), loadLocale(locales, locale)]),
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),
enPhrases = _await$Promise$all2[0],
otherPhrases = _await$Promise$all2[1]; // enPhrases are the English phrases and otherPhrases should be the target locale's phrases
// otherPhrases clobbers the English phrase key if it exists
return _context2.abrupt("return", loadLocale(locales, locale));
case 2:
_context2.next = 4;
return Promise.all([loadLocale(locales, SupportedLocales.en_US), loadLocale(locales, locale)]);
return _objectSpread({}, enPhrases, otherPhrases);
};
case 4:
_ref3 = _context2.sent;
_ref4 = _slicedToArray(_ref3, 2);
enPhrases = _ref4[0];
otherPhrases = _ref4[1];
return _context2.abrupt("return", _objectSpread({}, enPhrases, otherPhrases));
case 9:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
return function loadPhrases(_x3) {
return _ref2.apply(this, arguments);
};
}();
return loadPhrases;

@@ -108,0 +52,0 @@ };

@@ -1,3 +0,1 @@

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import set from 'lodash/set';

@@ -29,10 +27,8 @@ import { Interpolation } from './Interpolation';

export function prepareTranslations(namespace, trans) {
var translations = flattenCatalog(namespace, trans);
var keys = Object.keys(translations).reduce(function (result, key) {
return set(result, key.substring("".concat(namespace, ".").length), key);
}, {});
const translations = flattenCatalog(namespace, trans);
const keys = Object.keys(translations).reduce((result, key) => set(result, key.substring(`${namespace}.`.length), key), {});
return {
translations: translations,
keys: keys,
namespace: namespace
translations,
keys,
namespace
};

@@ -60,7 +56,7 @@ }

function flattenCatalog(namespace, obj) {
var result = {};
var keys = [namespace];
const result = {};
const keys = [namespace];
function iterate(obj) {
Object.keys(obj).forEach(function (key) {
Object.keys(obj).forEach(key => {
keys.push(key);

@@ -70,3 +66,3 @@

result[keys.join('.')] = obj[key].toString();
} else if (_typeof(obj[key]) === 'object' && obj[key] !== null) {
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
iterate(obj[key]);

@@ -73,0 +69,0 @@ }

@@ -1,15 +0,1 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -21,3 +7,3 @@

import mapValues from 'lodash/mapValues';
import pseudoloc from 'pseudoloc/index-browserify';
import pseudoloc from './pseudoloc';
pseudoloc.option.delimiter = '%';

@@ -27,10 +13,4 @@ pseudoloc.option.startDelimiter = '{';

var Translator =
/*#__PURE__*/
function () {
function Translator(options) {
var _this = this;
_classCallCheck(this, Translator);
class Translator {
constructor(options) {
_defineProperty(this, "map", void 0);

@@ -42,22 +22,18 @@

_defineProperty(this, "psudoLocalizePhrases", function (phrases) {
return Object.entries(phrases).reduce(function (acc, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return Object.assign(acc, _defineProperty({}, key, pseudoloc.str(value)));
}, {});
_defineProperty(this, "psudoLocalizePhrases", phrases => {
return Object.entries(phrases).reduce((acc, [key, value]) => Object.assign(acc, {
[key]: pseudoloc.str(value)
}), {});
});
_defineProperty(this, "getInstance", function (locale) {
_defineProperty(this, "getInstance", locale => {
if (locale) {
return _this.map[locale];
return this.map[locale];
} else {
return _this.map[_this.currentLocale];
return this.map[this.currentLocale];
}
});
_defineProperty(this, "getInstanceMatchingPhrase", function (phrase) {
var p = _this.getInstance();
_defineProperty(this, "getInstanceMatchingPhrase", phrase => {
const p = this.getInstance();

@@ -67,11 +43,11 @@ if (p.has(phrase)) {

} else {
return _this.getInstance(SupportedLocales.en_US);
return this.getInstance(SupportedLocales.en_US);
}
});
_defineProperty(this, "extend", function (phrases, locale) {
var p = _this.getInstance(locale);
_defineProperty(this, "extend", (phrases, locale) => {
const p = this.getInstance(locale);
if (_this.options.pseudoLoc) {
phrases = _this.psudoLocalizePhrases(phrases);
if (this.options.pseudoLoc) {
phrases = this.psudoLocalizePhrases(phrases);
}

@@ -82,4 +58,4 @@

_defineProperty(this, "t", function (phrase, arg) {
var p = _this.getInstanceMatchingPhrase(phrase);
_defineProperty(this, "t", (phrase, arg) => {
const p = this.getInstanceMatchingPhrase(phrase);

@@ -97,39 +73,39 @@ if (arg) {

_defineProperty(this, "tm", function (phrase, arg) {
return markdown(_this.t(phrase, arg));
_defineProperty(this, "tm", (phrase, arg) => {
return markdown(this.t(phrase, arg));
});
_defineProperty(this, "clear", function () {
_this.getInstance().clear();
_defineProperty(this, "clear", () => {
this.getInstance().clear();
});
_defineProperty(this, "replace", function (phrases) {
if (_this.options.pseudoLoc) {
phrases = _this.psudoLocalizePhrases(phrases);
_defineProperty(this, "replace", phrases => {
if (this.options.pseudoLoc) {
phrases = this.psudoLocalizePhrases(phrases);
}
_this.getInstance().replace(phrases);
this.getInstance().replace(phrases);
});
_defineProperty(this, "locale", function (locale) {
_defineProperty(this, "locale", locale => {
if (locale) {
_this.currentLocale = locale;
this.currentLocale = locale;
if (!_this.map[locale]) {
_this.createInstance(locale);
if (!this.map[locale]) {
this.createInstance(locale);
}
}
return _this.currentLocale;
return this.currentLocale;
});
_defineProperty(this, "has", function (phrase) {
return _this.getInstanceMatchingPhrase(phrase).has(phrase);
_defineProperty(this, "has", phrase => {
return this.getInstanceMatchingPhrase(phrase).has(phrase);
});
_defineProperty(this, "translateSeconds", function (seconds) {
_defineProperty(this, "translateSeconds", seconds => {
// Prevent 0 seconds returning "0 days"
if (Number(seconds) !== 0) {
if (seconds % 86400 === 0) {
return _this.t('time.num_days', {
return this.t('time.num_days', {
smart_count: seconds / 86400

@@ -140,3 +116,3 @@ });

if (seconds % 3600 === 0) {
return _this.t('time.num_hours', {
return this.t('time.num_hours', {
smart_count: seconds / 3600

@@ -147,3 +123,3 @@ });

if (seconds % 60 === 0) {
return _this.t('time.num_minutes', {
return this.t('time.num_minutes', {
smart_count: seconds / 60

@@ -154,3 +130,3 @@ });

return _this.t('time.num_seconds', {
return this.t('time.num_seconds', {
smart_count: seconds

@@ -160,4 +136,4 @@ });

_defineProperty(this, "translateObject", function (phrases) {
return mapValues(phrases, _this.t);
_defineProperty(this, "translateObject", phrases => {
return mapValues(phrases, this.t);
});

@@ -180,18 +156,14 @@

_createClass(Translator, [{
key: "createInstance",
value: function createInstance(locale) {
if (this.options.pseudoLoc && this.options.phrases) {
this.options.phrases = this.psudoLocalizePhrases(this.options.phrases);
}
this.map[locale] = new Polyglot(Object.assign(this.options, {
locale: locale
}));
createInstance(locale) {
if (this.options.pseudoLoc && this.options.phrases) {
this.options.phrases = this.psudoLocalizePhrases(this.options.phrases);
}
}]);
return Translator;
}();
this.map[locale] = new Polyglot(Object.assign(this.options, {
locale
}));
}
}
export default Translator;

@@ -1,2 +0,2 @@

export var SupportedLocales; // A Locale is the string actually used in the frontend, like 'en-US'
export let SupportedLocales; // A Locale is the string actually used in the frontend, like 'en-US'
// This is aliased to make a slightly easier to read type

@@ -3,0 +3,0 @@

@@ -17,5 +17,3 @@ "use strict";

var Interpolation =
/*#__PURE__*/
function () {
var Interpolation = /*#__PURE__*/function () {
function Interpolation(value, keys) {

@@ -22,0 +20,0 @@ _classCallCheck(this, Interpolation);

@@ -10,12 +10,16 @@ "use strict";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -27,8 +31,4 @@

var loadLocale =
/*#__PURE__*/
function () {
var _ref = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(locales, locale) {
var loadLocale = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(locales, locale) {
var module;

@@ -72,9 +72,5 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

var makeLoadPhrases = function loadPhrases(locales) {
var loadPhrases =
/*#__PURE__*/
function () {
var _ref2 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(locale) {
var _ref3, _ref4, enPhrases, otherPhrases;
var loadPhrases = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(locale) {
var _yield$Promise$all, _yield$Promise$all2, enPhrases, otherPhrases;

@@ -97,6 +93,6 @@ return regeneratorRuntime.wrap(function _callee2$(_context2) {

case 4:
_ref3 = _context2.sent;
_ref4 = _slicedToArray(_ref3, 2);
enPhrases = _ref4[0];
otherPhrases = _ref4[1];
_yield$Promise$all = _context2.sent;
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
enPhrases = _yield$Promise$all2[0];
otherPhrases = _yield$Promise$all2[1];
return _context2.abrupt("return", _objectSpread({}, enPhrases, otherPhrases));

@@ -103,0 +99,0 @@

@@ -14,3 +14,3 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -17,0 +17,0 @@ /**

@@ -16,12 +16,16 @@ "use strict";

var _indexBrowserify = _interopRequireDefault(require("pseudoloc/index-browserify"));
var _pseudoloc = _interopRequireDefault(require("./pseudoloc"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -37,9 +41,7 @@

_indexBrowserify.default.option.delimiter = '%';
_indexBrowserify.default.option.startDelimiter = '{';
_indexBrowserify.default.option.endDelimiter = '}';
_pseudoloc.default.option.delimiter = '%';
_pseudoloc.default.option.startDelimiter = '{';
_pseudoloc.default.option.endDelimiter = '}';
var Translator =
/*#__PURE__*/
function () {
var Translator = /*#__PURE__*/function () {
function Translator(options) {

@@ -62,3 +64,3 @@ var _this = this;

return Object.assign(acc, _defineProperty({}, key, _indexBrowserify.default.str(value)));
return Object.assign(acc, _defineProperty({}, key, _pseudoloc.default.str(value)));
}, {});

@@ -65,0 +67,0 @@ });

{
"name": "@cloudflare/intl-core",
"description": "",
"version": "1.6.2",
"version": "1.6.3",
"types": "./dist/index.d.ts",

@@ -18,5 +18,5 @@ "main": "lib/index.js",

"@types/lodash": "^4.14.107",
"@types/node-polyglot": "^2.4.1",
"lodash": "^4.17.15",
"node-polyglot": "^2.3.0",
"pseudoloc": "^1.1.0"
"node-polyglot": "^2.3.0"
},

@@ -36,3 +36,3 @@ "peerDependencies": {

},
"gitHead": "3b74aee5f2437d3981de017126c02cd66ffbeb2d"
"gitHead": "780d148e1865da2dd1d1a9077ceca2a9be40ee99"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc