Comparing version 2.3.0 to 2.3.1
@@ -0,1 +1,4 @@ | ||
### 2.3.1 | ||
- build /dist/es with included babelhelpers | ||
### 2.3.0 | ||
@@ -2,0 +5,0 @@ - change build chain to use rollup...allows 'js:next' and reduces build from 45kb to 33kb minified (/lib --> /dist/commonjs folder, new /dist/es for rollup,...) |
@@ -0,1 +1,13 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import * as utils from './utils'; | ||
@@ -15,10 +27,11 @@ import baseLogger from './logger'; | ||
var Connector = function (_EventEmitter) { | ||
babelHelpers.inherits(Connector, _EventEmitter); | ||
_inherits(Connector, _EventEmitter); | ||
function Connector(backend, store, services) { | ||
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
babelHelpers.classCallCheck(this, Connector); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Connector).call(this)); | ||
_classCallCheck(this, Connector); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Connector).call(this)); | ||
_this.backend = backend; | ||
@@ -37,3 +50,3 @@ _this.store = store; | ||
babelHelpers.createClass(Connector, [{ | ||
_createClass(Connector, [{ | ||
key: 'queueLoad', | ||
@@ -98,3 +111,3 @@ value: function queueLoad(languages, namespaces, callback) { | ||
var _name$split2 = babelHelpers.slicedToArray(_name$split, 2); | ||
var _name$split2 = _slicedToArray(_name$split, 2); | ||
@@ -161,3 +174,3 @@ var lng = _name$split2[0]; | ||
} | ||
var options = babelHelpers.extends({}, this.backend.options, this.options.backend); | ||
var options = _extends({}, this.backend.options, this.options.backend); | ||
@@ -182,3 +195,3 @@ if (typeof languages === 'string') languages = this.services.languageUtils.toResolveHierarchy(languages); | ||
var _name$split4 = babelHelpers.slicedToArray(_name$split3, 2); | ||
var _name$split4 = _slicedToArray(_name$split3, 2); | ||
@@ -209,3 +222,3 @@ var l = _name$split4[0]; | ||
var _name$split6 = babelHelpers.slicedToArray(_name$split5, 2); | ||
var _name$split6 = _slicedToArray(_name$split5, 2); | ||
@@ -241,2 +254,3 @@ var lng = _name$split6[0]; | ||
}]); | ||
return Connector; | ||
@@ -243,0 +257,0 @@ }(EventEmitter); |
@@ -0,1 +1,11 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import * as utils from './utils'; | ||
@@ -6,10 +16,11 @@ import baseLogger from './logger'; | ||
var Connector = function (_EventEmitter) { | ||
babelHelpers.inherits(Connector, _EventEmitter); | ||
_inherits(Connector, _EventEmitter); | ||
function Connector(cache, store, services) { | ||
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
babelHelpers.classCallCheck(this, Connector); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Connector).call(this)); | ||
_classCallCheck(this, Connector); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Connector).call(this)); | ||
_this.cache = cache; | ||
@@ -25,3 +36,3 @@ _this.store = store; | ||
babelHelpers.createClass(Connector, [{ | ||
_createClass(Connector, [{ | ||
key: 'load', | ||
@@ -32,3 +43,3 @@ value: function load(languages, namespaces, callback) { | ||
if (!this.cache) return callback && callback(); | ||
var options = babelHelpers.extends({}, this.cache.options, this.options.cache); | ||
var options = _extends({}, this.cache.options, this.options.cache); | ||
@@ -62,2 +73,3 @@ if (typeof languages === 'string') languages = this.services.languageUtils.toResolveHierarchy(languages); | ||
}]); | ||
return Connector; | ||
@@ -64,0 +76,0 @@ }(EventEmitter); |
@@ -0,4 +1,8 @@ | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var EventEmitter = function () { | ||
function EventEmitter() { | ||
babelHelpers.classCallCheck(this, EventEmitter); | ||
_classCallCheck(this, EventEmitter); | ||
@@ -8,3 +12,3 @@ this.observers = {}; | ||
babelHelpers.createClass(EventEmitter, [{ | ||
_createClass(EventEmitter, [{ | ||
key: 'on', | ||
@@ -61,2 +65,3 @@ value: function on(events, listener) { | ||
}]); | ||
return EventEmitter; | ||
@@ -63,0 +68,0 @@ }(); |
@@ -0,1 +1,13 @@ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import baseLogger from './logger'; | ||
@@ -16,3 +28,3 @@ import EventEmitter from './EventEmitter'; | ||
var I18n = function (_EventEmitter) { | ||
babelHelpers.inherits(I18n, _EventEmitter); | ||
_inherits(I18n, _EventEmitter); | ||
@@ -22,6 +34,7 @@ function I18n() { | ||
var callback = arguments[1]; | ||
babelHelpers.classCallCheck(this, I18n); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(I18n).call(this)); | ||
_classCallCheck(this, I18n); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(I18n).call(this)); | ||
_this.options = transformOptions(options); | ||
@@ -36,3 +49,3 @@ _this.services = {}; | ||
babelHelpers.createClass(I18n, [{ | ||
_createClass(I18n, [{ | ||
key: 'init', | ||
@@ -49,7 +62,7 @@ value: function init(options, callback) { | ||
if (options.compatibilityAPI === 'v1') { | ||
this.options = babelHelpers.extends({}, getDefaults(), transformOptions(compat.convertAPIOptions(options)), {}); | ||
this.options = _extends({}, getDefaults(), transformOptions(compat.convertAPIOptions(options)), {}); | ||
} else if (options.compatibilityJSON === 'v1') { | ||
this.options = babelHelpers.extends({}, getDefaults(), transformOptions(compat.convertJSONOptions(options)), {}); | ||
this.options = _extends({}, getDefaults(), transformOptions(compat.convertJSONOptions(options)), {}); | ||
} else { | ||
this.options = babelHelpers.extends({}, getDefaults(), this.options, transformOptions(options)); | ||
this.options = _extends({}, getDefaults(), this.options, transformOptions(options)); | ||
} | ||
@@ -180,3 +193,3 @@ if (!callback) callback = function callback() {}; | ||
if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v; | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} else { | ||
@@ -323,3 +336,3 @@ callback(null); | ||
var clone = new I18n(babelHelpers.extends({}, options, this.options, { isClone: true }), callback); | ||
var clone = new I18n(_extends({}, options, this.options, { isClone: true }), callback); | ||
var membersToCopy = ['store', 'translator', 'services', 'language']; | ||
@@ -333,2 +346,3 @@ membersToCopy.forEach(function (m) { | ||
}]); | ||
return I18n; | ||
@@ -335,0 +349,0 @@ }(EventEmitter); |
@@ -0,1 +1,5 @@ | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import * as utils from './utils'; | ||
@@ -7,4 +11,5 @@ import baseLogger from './logger'; | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
babelHelpers.classCallCheck(this, Interpolator); | ||
_classCallCheck(this, Interpolator); | ||
this.logger = baseLogger.create('interpolator'); | ||
@@ -15,3 +20,3 @@ | ||
babelHelpers.createClass(Interpolator, [{ | ||
_createClass(Interpolator, [{ | ||
key: 'init', | ||
@@ -131,2 +136,3 @@ value: function init() { | ||
}]); | ||
return Interpolator; | ||
@@ -133,0 +139,0 @@ }(); |
@@ -0,1 +1,7 @@ | ||
var _slicedToArray = function () { function sliceIterator(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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import baseLogger from './logger'; | ||
@@ -5,3 +11,3 @@ | ||
function LanguageUtil(options) { | ||
babelHelpers.classCallCheck(this, LanguageUtil); | ||
_classCallCheck(this, LanguageUtil); | ||
@@ -14,3 +20,3 @@ this.options = options; | ||
babelHelpers.createClass(LanguageUtil, [{ | ||
_createClass(LanguageUtil, [{ | ||
key: 'getLanguagePartFromCode', | ||
@@ -30,3 +36,3 @@ value: function getLanguagePartFromCode(code) { | ||
var _code$split2 = babelHelpers.slicedToArray(_code$split, 2); | ||
var _code$split2 = _slicedToArray(_code$split, 2); | ||
@@ -78,2 +84,3 @@ var head = _code$split2[0]; | ||
}]); | ||
return LanguageUtil; | ||
@@ -80,0 +87,0 @@ }(); |
@@ -0,1 +1,7 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var consoleLogger = { | ||
@@ -21,4 +27,5 @@ type: 'logger', | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
babelHelpers.classCallCheck(this, Logger); | ||
_classCallCheck(this, Logger); | ||
this.subs = []; | ||
@@ -28,3 +35,3 @@ this.init(concreteLogger, options); | ||
babelHelpers.createClass(Logger, [{ | ||
_createClass(Logger, [{ | ||
key: 'init', | ||
@@ -77,3 +84,3 @@ value: function init(concreteLogger) { | ||
value: function create(moduleName) { | ||
var sub = new Logger(this.logger, babelHelpers.extends({ prefix: this.prefix + ':' + moduleName + ':' }, this.options)); | ||
var sub = new Logger(this.logger, _extends({ prefix: this.prefix + ':' + moduleName + ':' }, this.options)); | ||
this.subs.push(sub); | ||
@@ -89,2 +96,3 @@ | ||
}]); | ||
return Logger; | ||
@@ -91,0 +99,0 @@ }(); |
@@ -0,1 +1,5 @@ | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import baseLogger from './logger'; | ||
@@ -77,4 +81,5 @@ | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
babelHelpers.classCallCheck(this, PluralResolver); | ||
_classCallCheck(this, PluralResolver); | ||
this.rules = function () { | ||
@@ -100,3 +105,3 @@ var l, | ||
babelHelpers.createClass(PluralResolver, [{ | ||
_createClass(PluralResolver, [{ | ||
key: 'addRule', | ||
@@ -151,2 +156,3 @@ value: function addRule(lng, obj) { | ||
}]); | ||
return PluralResolver; | ||
@@ -153,0 +159,0 @@ }(); |
@@ -0,1 +1,11 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import EventEmitter from './EventEmitter'; | ||
@@ -5,3 +15,3 @@ import * as utils from './utils'; | ||
var ResourceStore = function (_EventEmitter) { | ||
babelHelpers.inherits(ResourceStore, _EventEmitter); | ||
_inherits(ResourceStore, _EventEmitter); | ||
@@ -11,6 +21,7 @@ function ResourceStore() { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? { ns: ['translation'], defaultNS: 'translation' } : arguments[1]; | ||
babelHelpers.classCallCheck(this, ResourceStore); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(ResourceStore).call(this)); | ||
_classCallCheck(this, ResourceStore); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ResourceStore).call(this)); | ||
_this.data = data; | ||
@@ -21,3 +32,3 @@ _this.options = options; | ||
babelHelpers.createClass(ResourceStore, [{ | ||
_createClass(ResourceStore, [{ | ||
key: 'addNamespaces', | ||
@@ -104,3 +115,3 @@ value: function addNamespaces(ns) { | ||
} else { | ||
pack = babelHelpers.extends({}, pack, resources); | ||
pack = _extends({}, pack, resources); | ||
} | ||
@@ -133,3 +144,3 @@ | ||
// TODO: COMPATIBILITY remove extend in v2.1.0 | ||
if (this.options.compatibilityAPI === 'v1') return babelHelpers.extends({}, this.getResource(lng, ns)); | ||
if (this.options.compatibilityAPI === 'v1') return _extends({}, this.getResource(lng, ns)); | ||
@@ -144,2 +155,3 @@ return this.getResource(lng, ns); | ||
}]); | ||
return ResourceStore; | ||
@@ -146,0 +158,0 @@ }(EventEmitter); |
@@ -0,1 +1,13 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import baseLogger from './logger'; | ||
@@ -8,10 +20,11 @@ import EventEmitter from './EventEmitter'; | ||
var Translator = function (_EventEmitter) { | ||
babelHelpers.inherits(Translator, _EventEmitter); | ||
_inherits(Translator, _EventEmitter); | ||
function Translator(services) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
babelHelpers.classCallCheck(this, Translator); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Translator).call(this)); | ||
_classCallCheck(this, Translator); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Translator).call(this)); | ||
utils.copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector'], services, _this); | ||
@@ -24,3 +37,3 @@ | ||
babelHelpers.createClass(Translator, [{ | ||
_createClass(Translator, [{ | ||
key: 'changeLanguage', | ||
@@ -65,3 +78,3 @@ value: function changeLanguage(lng) { | ||
if ((typeof options === 'undefined' ? 'undefined' : babelHelpers.typeof(options)) !== 'object') { | ||
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') { | ||
options = this.options.overloadTranslationOptionHandler(arguments); | ||
@@ -110,3 +123,3 @@ } else if (this.options.compatibilityAPI === 'v1') { | ||
for (var m in res) { | ||
copy[m] = this.translate('' + key + keySeparator + m, babelHelpers.extends({ joinArrays: false, ns: namespaces }, options)); | ||
copy[m] = this.translate('' + key + keySeparator + m, _extends({ joinArrays: false, ns: namespaces }, options)); | ||
} | ||
@@ -184,3 +197,3 @@ res = copy; | ||
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options; | ||
if (this.options.interpolation.defaultVariables) data = babelHelpers.extends({}, this.options.interpolation.defaultVariables, data); | ||
if (this.options.interpolation.defaultVariables) data = _extends({}, this.options.interpolation.defaultVariables, data); | ||
res = this.interpolator.interpolate(res, data); | ||
@@ -282,2 +295,3 @@ | ||
}]); | ||
return Translator; | ||
@@ -284,0 +298,0 @@ }(EventEmitter); |
{ | ||
"name": "i18next", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "i18next internationalization framework", | ||
@@ -29,2 +29,3 @@ "main": "dist/commonjs/index.js", | ||
"babel-preset-es2015": "6.6.0", | ||
"babel-preset-es2015-native-modules": "^6.6.0", | ||
"babel-preset-es2015-rollup": "1.1.1", | ||
@@ -76,3 +77,3 @@ "babel-preset-stage-0": "^6.5.0", | ||
"copy": "cp ./dist/umd/i18next.min.js ./i18next.min.js && cp ./dist/umd/i18next.js ./i18next.js", | ||
"build:es": "BABEL_ENV=es babel src --out-dir dist/es", | ||
"build:es": "BABEL_ENV=jsnext babel src --out-dir dist/es", | ||
"build:cjs": "babel src --out-dir dist/commonjs", | ||
@@ -79,0 +80,0 @@ "build:umd": "rollup -c rollup.config.js --format umd && rollup -c rollup.config.js --format umd --uglify", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
438441
59
8145
0
42