i18next-xhr-backend
Advanced tools
Comparing version 0.6.0 to 1.0.0
@@ -7,4 +7,18 @@ (function (global, factory) { | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
@@ -15,3 +29,3 @@ } : function (obj) { | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
@@ -22,3 +36,3 @@ throw new TypeError("Cannot call a class as a function"); | ||
babelHelpers.createClass = function () { | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
@@ -41,23 +55,6 @@ for (var i = 0; i < props.length; i++) { | ||
babelHelpers; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : babelHelpers.typeof(data)) === 'object') { | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
@@ -134,3 +131,3 @@ e = encodeURIComponent; | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
babelHelpers.classCallCheck(this, Backend); | ||
classCallCheck(this, Backend); | ||
@@ -142,3 +139,3 @@ this.init(services, options); | ||
babelHelpers.createClass(Backend, [{ | ||
createClass(Backend, [{ | ||
key: 'init', | ||
@@ -145,0 +142,0 @@ value: function init(services) { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("i18nextXHRBackend",e):t.i18nextXHRBackend=e()}(this,function(){"use strict";function t(t){return a.call(r.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function e(t,e,n,i,a){if(i&&"object"===("undefined"==typeof i?"undefined":o["typeof"](i))){var r="",s=encodeURIComponent;for(var l in i)r+="&"+s(l)+"="+s(i[l]);i=r.slice(1)+(a?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(i?"POST":"GET",t,1),e.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),i&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&n&&n(c.responseText,c)},c.send(i)}catch(s){window.console&&console.log(s)}}function n(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:e}}var o={};o["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=[],a=i.forEach,r=i.slice,s=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];o.classCallCheck(this,e),this.init(t,n),this.type="backend"}return o.createClass(e,[{key:"init",value:function(e){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.services=e,this.options=t(o,this.options||{},n())}},{key:"readMulti",value:function(t,e,n){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(o,n)}},{key:"read",value:function(t,e,n){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t,ns:e});this.loadUrl(o,n)}},{key:"loadUrl",value:function(t,e){var n=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return e("failed loading "+t,!0);if(i.status>=400&&i.status<500)return e("failed loading "+t,!1);var a=void 0,r=void 0;try{a=n.options.parse(o,t)}catch(s){r="failed parsing "+t+" to json"}return r?e(r,!1):void e(null,a)})}},{key:"create",value:function(t,e,n,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[n]=o||"",t.forEach(function(t){var n=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:e});i.options.ajax(n,i.options,function(t,e){},a)})}}]),e}();return s.type="backend",s}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define("i18nextXHRBackend",n):t.i18nextXHRBackend=n()}(this,function(){"use strict";function t(t){return i.call(a.call(arguments,1),function(n){if(n)for(var e in n)void 0===t[e]&&(t[e]=n[e])}),t}function n(t,n,e,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":r(o))){var a="",s=encodeURIComponent;for(var l in o)a+="&"+s(l)+"="+s(o[l]);o=a.slice(1)+(i?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(o?"POST":"GET",t,1),n.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),o&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&e&&e(c.responseText,c)},c.send(o)}catch(t){window.console&&console.log(t)}}function e(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:n}}var o=[],i=o.forEach,a=o.slice,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),c=function(){function n(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];s(this,n),this.init(t,e),this.type="backend"}return l(n,[{key:"init",value:function(n){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.services=n,this.options=t(o,this.options||{},e())}},{key:"readMulti",value:function(t,n,e){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t.join("+"),ns:n.join("+")});this.loadUrl(o,e)}},{key:"read",value:function(t,n,e){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t,ns:n});this.loadUrl(o,e)}},{key:"loadUrl",value:function(t,n){var e=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return n("failed loading "+t,!0);if(i.status>=400&&i.status<500)return n("failed loading "+t,!1);var a=void 0,r=void 0;try{a=e.options.parse(o,t)}catch(n){r="failed parsing "+t+" to json"}return r?n(r,!1):void n(null,a)})}},{key:"create",value:function(t,n,e,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[e]=o||"",t.forEach(function(t){var e=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:n});i.options.ajax(e,i.options,function(t,n){},a)})}}]),n}();return c.type="backend",c}); |
@@ -7,4 +7,18 @@ (function (global, factory) { | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
@@ -15,3 +29,3 @@ } : function (obj) { | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
@@ -22,3 +36,3 @@ throw new TypeError("Cannot call a class as a function"); | ||
babelHelpers.createClass = function () { | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
@@ -41,23 +55,6 @@ for (var i = 0; i < props.length; i++) { | ||
babelHelpers; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : babelHelpers.typeof(data)) === 'object') { | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
@@ -134,3 +131,3 @@ e = encodeURIComponent; | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
babelHelpers.classCallCheck(this, Backend); | ||
classCallCheck(this, Backend); | ||
@@ -142,3 +139,3 @@ this.init(services, options); | ||
babelHelpers.createClass(Backend, [{ | ||
createClass(Backend, [{ | ||
key: 'init', | ||
@@ -145,0 +142,0 @@ value: function init(services) { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("i18nextXHRBackend",e):t.i18nextXHRBackend=e()}(this,function(){"use strict";function t(t){return a.call(r.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function e(t,e,n,i,a){if(i&&"object"===("undefined"==typeof i?"undefined":o["typeof"](i))){var r="",s=encodeURIComponent;for(var l in i)r+="&"+s(l)+"="+s(i[l]);i=r.slice(1)+(a?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(i?"POST":"GET",t,1),e.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),i&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&n&&n(c.responseText,c)},c.send(i)}catch(s){window.console&&console.log(s)}}function n(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:e}}var o={};o["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=[],a=i.forEach,r=i.slice,s=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];o.classCallCheck(this,e),this.init(t,n),this.type="backend"}return o.createClass(e,[{key:"init",value:function(e){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.services=e,this.options=t(o,this.options||{},n())}},{key:"readMulti",value:function(t,e,n){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(o,n)}},{key:"read",value:function(t,e,n){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t,ns:e});this.loadUrl(o,n)}},{key:"loadUrl",value:function(t,e){var n=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return e("failed loading "+t,!0);if(i.status>=400&&i.status<500)return e("failed loading "+t,!1);var a=void 0,r=void 0;try{a=n.options.parse(o,t)}catch(s){r="failed parsing "+t+" to json"}return r?e(r,!1):void e(null,a)})}},{key:"create",value:function(t,e,n,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[n]=o||"",t.forEach(function(t){var n=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:e});i.options.ajax(n,i.options,function(t,e){},a)})}}]),e}();return s.type="backend",s}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define("i18nextXHRBackend",n):t.i18nextXHRBackend=n()}(this,function(){"use strict";function t(t){return i.call(a.call(arguments,1),function(n){if(n)for(var e in n)void 0===t[e]&&(t[e]=n[e])}),t}function n(t,n,e,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":r(o))){var a="",s=encodeURIComponent;for(var l in o)a+="&"+s(l)+"="+s(o[l]);o=a.slice(1)+(i?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(o?"POST":"GET",t,1),n.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),o&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&e&&e(c.responseText,c)},c.send(o)}catch(t){window.console&&console.log(t)}}function e(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:n}}var o=[],i=o.forEach,a=o.slice,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),c=function(){function n(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];s(this,n),this.init(t,e),this.type="backend"}return l(n,[{key:"init",value:function(n){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.services=n,this.options=t(o,this.options||{},e())}},{key:"readMulti",value:function(t,n,e){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t.join("+"),ns:n.join("+")});this.loadUrl(o,e)}},{key:"read",value:function(t,n,e){var o=this.services.interpolator.interpolate(this.options.loadPath,{lng:t,ns:n});this.loadUrl(o,e)}},{key:"loadUrl",value:function(t,n){var e=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return n("failed loading "+t,!0);if(i.status>=400&&i.status<500)return n("failed loading "+t,!1);var a=void 0,r=void 0;try{a=e.options.parse(o,t)}catch(n){r="failed parsing "+t+" to json"}return r?n(r,!1):void n(null,a)})}},{key:"create",value:function(t,n,e,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[e]=o||"",t.forEach(function(t){var e=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:n});i.options.ajax(e,i.options,function(t,n){},a)})}}]),n}();return c.type="backend",c}); |
{ | ||
"name": "i18next-xhr-backend", | ||
"version": "0.6.0", | ||
"version": "1.0.0", | ||
"description": "backend layer for i18next using browsers xhr", | ||
@@ -15,43 +15,43 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"babel-cli": "6.6.5", | ||
"babel-core": "6.4.5", | ||
"babel-eslint": "6.0.0-beta.5", | ||
"babel-preset-es2015": "6.6.0", | ||
"babel-preset-es2015-native-modules": "^6.6.0", | ||
"babel-cli": "6.11.4", | ||
"babel-core": "6.11.4", | ||
"babel-eslint": "6.1.2", | ||
"babel-preset-es2015": "6.9.0", | ||
"babel-preset-es2015-native-modules": "6.9.2", | ||
"babel-preset-es2015-rollup": "1.1.1", | ||
"babel-preset-stage-0": "6.5.0", | ||
"babelify": "7.2.0", | ||
"browserify": "12.0.1", | ||
"browserify-istanbul": "1.0.0", | ||
"babelify": "7.3.0", | ||
"browserify": "13.0.1", | ||
"browserify-istanbul": "2.0.0", | ||
"chai": "3.5.0", | ||
"coveralls": "2.11.8", | ||
"eslint": "2.2.0", | ||
"eslint-config-airbnb": "6.0.2", | ||
"i18next": "2.3.0", | ||
"coveralls": "2.11.11", | ||
"eslint": "3.1.1", | ||
"eslint-config-airbnb": "9.0.1", | ||
"i18next": "3.4.1", | ||
"istanbul": "gotwarlost/istanbul#source-map", | ||
"json5": "^0.4.0", | ||
"karma": "0.13.22", | ||
"karma-browserify": "5.0.1", | ||
"json5": "^0.5.0", | ||
"karma": "1.1.1", | ||
"karma-browserify": "5.1.0", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "0.2.2", | ||
"karma-cli": "0.1.2", | ||
"karma-chrome-launcher": "1.0.1", | ||
"karma-cli": "1.0.1", | ||
"karma-coverage": "douglasduteil/karma-coverage#next", | ||
"karma-coveralls": "1.1.2", | ||
"karma-expect": "1.1.2", | ||
"karma-mocha": "0.2.2", | ||
"karma-phantomjs-launcher": "1.0.0", | ||
"karma-rollup-preprocessor": "^2.0.1", | ||
"karma-sinon": "1.0.4", | ||
"karma-spec-reporter": "0.0.24", | ||
"karma-mocha": "1.1.1", | ||
"karma-phantomjs-launcher": "1.0.1", | ||
"karma-rollup-preprocessor": "2.0.2", | ||
"karma-sinon": "1.0.5", | ||
"karma-spec-reporter": "0.0.26", | ||
"mkdirp": "0.5.1", | ||
"mocha": "2.4.5", | ||
"phantomjs": "1.9.19", | ||
"mocha": "2.5.3", | ||
"phantomjs": "2.1.7", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"rimraf": "2.5.2", | ||
"rollup": "0.25.4", | ||
"rollup-plugin-babel": "2.4.0", | ||
"rollup-plugin-npm": "1.4.0", | ||
"rollup-plugin-uglify": "0.2.0", | ||
"sinon": "1.17.3", | ||
"yargs": "4.1.0" | ||
"rimraf": "2.5.4", | ||
"rollup": "0.34.1", | ||
"rollup-plugin-babel": "2.6.1", | ||
"rollup-plugin-node-resolve": "1.7.1", | ||
"rollup-plugin-uglify": "1.0.1", | ||
"sinon": "1.17.4", | ||
"yargs": "4.8.1" | ||
}, | ||
@@ -58,0 +58,0 @@ "scripts": { |
import babel from 'rollup-plugin-babel'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import npm from 'rollup-plugin-npm'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import { argv } from 'yargs'; | ||
@@ -26,3 +26,3 @@ | ||
babel(babelOptions), | ||
npm({ jsnext: true }) | ||
nodeResolve({ jsnext: true }) | ||
].concat(compress ? uglify() : []), | ||
@@ -29,0 +29,0 @@ moduleName: 'i18nextXHRBackend', |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18
0
41399
748