i18next-fetch-backend
Advanced tools
Comparing version 2.3.1 to 3.0.0
@@ -40,16 +40,31 @@ 'use strict'; | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(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; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -91,3 +106,3 @@ | ||
function isNativeReflectConstruct() { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
@@ -106,3 +121,3 @@ if (Reflect.construct.sham) return false; | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
@@ -177,2 +192,19 @@ } else { | ||
function _createSuper(Derived) { | ||
return function () { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (_isNativeReflectConstruct()) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
var defaults = { | ||
@@ -201,7 +233,7 @@ loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
var BackendError = | ||
/*#__PURE__*/ | ||
function (_Error) { | ||
var BackendError = /*#__PURE__*/function (_Error) { | ||
_inherits(BackendError, _Error); | ||
var _super = _createSuper(BackendError); | ||
function BackendError(message) { | ||
@@ -214,3 +246,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(BackendError).call(this, message)); | ||
_this = _super.call(this, message); | ||
@@ -224,7 +256,5 @@ _defineProperty(_assertThisInitialized(_this), "retry", null); | ||
return BackendError; | ||
}(_wrapNativeSuper(Error)); | ||
}( /*#__PURE__*/_wrapNativeSuper(Error)); | ||
var Backend = | ||
/*#__PURE__*/ | ||
function () { | ||
var Backend = /*#__PURE__*/function () { | ||
function Backend(services, options) { | ||
@@ -243,3 +273,3 @@ _classCallCheck(this, Backend); | ||
this.services = services; | ||
this.options = _objectSpread({}, defaults, this.options, options); | ||
this.options = _objectSpread2({}, defaults, {}, this.options, {}, options); | ||
} | ||
@@ -298,3 +328,3 @@ }, { | ||
} | ||
}).catch(function (e) { | ||
})["catch"](function (e) { | ||
if (e instanceof BackendError) { | ||
@@ -325,3 +355,3 @@ callback(e.message, e.retry); | ||
try { | ||
fetch(url, _objectSpread({ | ||
fetch(url, _objectSpread2({ | ||
method: 'POST', | ||
@@ -331,3 +361,3 @@ body: stringify(payload) | ||
} catch (ex) { | ||
console.error(ex); | ||
console.error(ex); // eslint-disable-line no-console | ||
} | ||
@@ -344,1 +374,2 @@ }); | ||
module.exports = Backend; | ||
//# sourceMappingURL=i18next-fetch-backend.cjs.js.map |
@@ -38,16 +38,31 @@ function _classCallCheck(instance, Constructor) { | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(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; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -89,3 +104,3 @@ | ||
function isNativeReflectConstruct() { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
@@ -104,3 +119,3 @@ if (Reflect.construct.sham) return false; | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
@@ -175,2 +190,19 @@ } else { | ||
function _createSuper(Derived) { | ||
return function () { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (_isNativeReflectConstruct()) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
var defaults = { | ||
@@ -199,7 +231,7 @@ loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
var BackendError = | ||
/*#__PURE__*/ | ||
function (_Error) { | ||
var BackendError = /*#__PURE__*/function (_Error) { | ||
_inherits(BackendError, _Error); | ||
var _super = _createSuper(BackendError); | ||
function BackendError(message) { | ||
@@ -212,3 +244,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(BackendError).call(this, message)); | ||
_this = _super.call(this, message); | ||
@@ -222,7 +254,5 @@ _defineProperty(_assertThisInitialized(_this), "retry", null); | ||
return BackendError; | ||
}(_wrapNativeSuper(Error)); | ||
}( /*#__PURE__*/_wrapNativeSuper(Error)); | ||
var Backend = | ||
/*#__PURE__*/ | ||
function () { | ||
var Backend = /*#__PURE__*/function () { | ||
function Backend(services, options) { | ||
@@ -241,3 +271,3 @@ _classCallCheck(this, Backend); | ||
this.services = services; | ||
this.options = _objectSpread({}, defaults, this.options, options); | ||
this.options = _objectSpread2({}, defaults, {}, this.options, {}, options); | ||
} | ||
@@ -296,3 +326,3 @@ }, { | ||
} | ||
}).catch(function (e) { | ||
})["catch"](function (e) { | ||
if (e instanceof BackendError) { | ||
@@ -323,3 +353,3 @@ callback(e.message, e.retry); | ||
try { | ||
fetch(url, _objectSpread({ | ||
fetch(url, _objectSpread2({ | ||
method: 'POST', | ||
@@ -329,3 +359,3 @@ body: stringify(payload) | ||
} catch (ex) { | ||
console.error(ex); | ||
console.error(ex); // eslint-disable-line no-console | ||
} | ||
@@ -332,0 +362,0 @@ }); |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = global || self, global.I18nextFetchBackend = factory()); | ||
}(this, function () { 'use strict'; | ||
}(this, (function () { 'use strict'; | ||
@@ -45,16 +45,31 @@ function _classCallCheck(instance, Constructor) { | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(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; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -96,3 +111,3 @@ | ||
function isNativeReflectConstruct() { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
@@ -111,3 +126,3 @@ if (Reflect.construct.sham) return false; | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
@@ -182,2 +197,19 @@ } else { | ||
function _createSuper(Derived) { | ||
return function () { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (_isNativeReflectConstruct()) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
var defaults = { | ||
@@ -206,7 +238,7 @@ loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
var BackendError = | ||
/*#__PURE__*/ | ||
function (_Error) { | ||
var BackendError = /*#__PURE__*/function (_Error) { | ||
_inherits(BackendError, _Error); | ||
var _super = _createSuper(BackendError); | ||
function BackendError(message) { | ||
@@ -219,3 +251,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(BackendError).call(this, message)); | ||
_this = _super.call(this, message); | ||
@@ -229,7 +261,5 @@ _defineProperty(_assertThisInitialized(_this), "retry", null); | ||
return BackendError; | ||
}(_wrapNativeSuper(Error)); | ||
}( /*#__PURE__*/_wrapNativeSuper(Error)); | ||
var Backend = | ||
/*#__PURE__*/ | ||
function () { | ||
var Backend = /*#__PURE__*/function () { | ||
function Backend(services, options) { | ||
@@ -248,3 +278,3 @@ _classCallCheck(this, Backend); | ||
this.services = services; | ||
this.options = _objectSpread({}, defaults, this.options, options); | ||
this.options = _objectSpread2({}, defaults, {}, this.options, {}, options); | ||
} | ||
@@ -303,3 +333,3 @@ }, { | ||
} | ||
}).catch(function (e) { | ||
})["catch"](function (e) { | ||
if (e instanceof BackendError) { | ||
@@ -330,3 +360,3 @@ callback(e.message, e.retry); | ||
try { | ||
fetch(url, _objectSpread({ | ||
fetch(url, _objectSpread2({ | ||
method: 'POST', | ||
@@ -336,3 +366,3 @@ body: stringify(payload) | ||
} catch (ex) { | ||
console.error(ex); | ||
console.error(ex); // eslint-disable-line no-console | ||
} | ||
@@ -350,2 +380,2 @@ }); | ||
})); | ||
}))); |
{ | ||
"name": "i18next-fetch-backend", | ||
"version": "2.3.1", | ||
"version": "3.0.0", | ||
"description": "backend layer for i18next using browsers fetch", | ||
@@ -10,7 +10,7 @@ "main": "dist/i18next-fetch-backend.cjs.js", | ||
"test": "mocha", | ||
"lint": "eslint src/", | ||
"lint": "eslint 'src/**/*.js' 'test/**/*.js'", | ||
"build": "rollup -c", | ||
"cover": "nyc npm test", | ||
"coveralls": "npm run cover && nyc report --reporter=text-lcov | coveralls", | ||
"prepare": "npm run lint && npm run build" | ||
"prepare": "npm run build && npm run lint" | ||
}, | ||
@@ -23,3 +23,3 @@ "files": [ | ||
"type": "git", | ||
"url": "git+https://github.com/perrin4869/i18next-fetch-backend.git" | ||
"url": "git+https://github.com/dotcore64/i18next-fetch-backend.git" | ||
}, | ||
@@ -33,30 +33,31 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/perrin4869/i18next-fetch-backend/issues" | ||
"url": "https://github.com/dotcore64/i18next-fetch-backend/issues" | ||
}, | ||
"homepage": "https://github.com/perrin4869/i18next-fetch-backend#readme", | ||
"homepage": "https://github.com/dotcore64/i18next-fetch-backend#readme", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.3.3", | ||
"@babel/plugin-proposal-class-properties": "^7.3.3", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/register": "^7.0.0", | ||
"babel-eslint": "^10.0.3", | ||
"babel-plugin-istanbul": "^5.1.1", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/register": "^7.9.0", | ||
"@istanbuljs/nyc-config-babel": "^3.0.0", | ||
"@rollup/plugin-babel": "^5.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.2", | ||
"coveralls": "^3.1.0", | ||
"env-test": "^1.0.0", | ||
"eslint": "^5.14.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-mocha": "^6.1.0", | ||
"finalhandler": "^1.1.1", | ||
"i18next": "^15.0.4", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-mocha": "^6.3.0", | ||
"finalhandler": "^1.1.2", | ||
"i18next": "^19.4.4", | ||
"isomorphic-fetch": "^2.2.1", | ||
"mocha": "^6.0.0", | ||
"nyc": "^13.3.0", | ||
"rollup": "^1.2.2", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"serve-static": "^1.13.2" | ||
"mocha": "^7.1.2", | ||
"nyc": "^15.0.1", | ||
"rollup": "^2.7.3", | ||
"serve-static": "^1.14.1" | ||
} | ||
} |
@@ -138,4 +138,4 @@ # Introduction | ||
[build-badge]: https://img.shields.io/travis/perrin4869/i18next-fetch-backend/master.svg?style=flat-square | ||
[build]: https://travis-ci.org/perrin4869/i18next-fetch-backend | ||
[build-badge]: https://img.shields.io/travis/dotcore64/i18next-fetch-backend/master.svg?style=flat-square | ||
[build]: https://travis-ci.org/dotcore64/i18next-fetch-backend | ||
@@ -145,9 +145,9 @@ [npm-badge]: https://img.shields.io/npm/v/i18next-fetch-backend.svg?style=flat-square | ||
[coveralls-badge]: https://img.shields.io/coveralls/perrin4869/i18next-fetch-backend/master.svg?style=flat-square | ||
[coveralls]: https://coveralls.io/r/perrin4869/i18next-fetch-backend | ||
[coveralls-badge]: https://img.shields.io/coveralls/dotcore64/i18next-fetch-backend/master.svg?style=flat-square | ||
[coveralls]: https://coveralls.io/r/dotcore64/i18next-fetch-backend | ||
[dependency-status-badge]: https://david-dm.org/perrin4869/i18next-fetch-backend.svg?style=flat-square | ||
[dependency-status]: https://david-dm.org/perrin4869/i18next-fetch-backend | ||
[dependency-status-badge]: https://david-dm.org/dotcore64/i18next-fetch-backend.svg?style=flat-square | ||
[dependency-status]: https://david-dm.org/dotcore64/i18next-fetch-backend | ||
[dev-dependency-status-badge]: https://david-dm.org/perrin4869/i18next-fetch-backend/dev-status.svg?style=flat-square | ||
[dev-dependency-status]: https://david-dm.org/perrin4869/i18next-fetch-backend#info=devDependencies | ||
[dev-dependency-status-badge]: https://david-dm.org/dotcore64/i18next-fetch-backend/dev-status.svg?style=flat-square | ||
[dev-dependency-status]: https://david-dm.org/dotcore64/i18next-fetch-backend#info=devDependencies |
46471
8
926
23