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

cldrjs

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cldrjs - npm Package Compare versions

Comparing version 0.3.8 to 0.3.9

DCO.md

2

bower.json
{
"name": "cldrjs",
"version": "0.3.8",
"version": "0.3.9",
"devDependencies": {

@@ -5,0 +5,0 @@ "chai": "1.7.x",

/**
* CLDR JavaScript Library v0.3.8
* CLDR JavaScript Library v0.3.9
* http://jquery.com/

@@ -9,6 +9,6 @@ *

*
* Date: 2014-07-13T05:05Z
* Date: 2014-10-14T21:16Z
*/
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg

@@ -32,3 +32,2 @@ */

var arrayForEach = function( array, callback ) {

@@ -348,4 +347,4 @@ var i, length;

var alwaysArray = function( stringOrArray ) {
return typeof stringOrArray === "string" ? [ stringOrArray ] : stringOrArray;
var alwaysArray = function( somethingOrArray ) {
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
};

@@ -423,5 +422,17 @@

Cldr.load = function( json ) {
var i, j;
validatePresence( json, "json" );
validateTypePlainObject( json, "json" );
Cldr._resolved = jsonMerge( Cldr._resolved, json );
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
for ( i = 0; i < arguments.length; i++ ) {
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
json = alwaysArray( arguments[ i ] );
for ( j = 0; j < json.length; j++ ) {
validateTypePlainObject( json[ j ], "json" );
Cldr._resolved = jsonMerge( Cldr._resolved, json[ j ] );
}
}
};

@@ -553,2 +564,3 @@

}));
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg
*/
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&"object"==typeof module.exports?module.exports=b():a.Cldr=b()}(this,function(){var a=function(a,b){var c,d;if(a.forEach)return a.forEach(b);for(c=0,d=a.length;d>c;c++)b(a[c],c,a)},b=function(a){var b,c=[];if(Object.keys)return Object.keys(a);for(b in a)c.push(b);return c},c=function(c,d){var e,f;return f=c+(d&&JSON?": "+JSON.stringify(d):""),e=new Error(f),e.code=c,a(b(d),function(a){e[a]=d[a]}),e},d=function(a,b,d){if(!b)throw c(a,d)},e=function(a,b){d("E_MISSING_PARAMETER","undefined"!=typeof a,{name:b})},f=function(a,b,c,e){d("E_INVALID_PAR_TYPE",c,{expected:e,name:b,value:a})},g=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},h=function(a,b){f(a,b,"string"==typeof a||g(a),"String or Array")},i=function(a){return null!==a&&""+a=="[object Object]"},j=function(a,b){f(a,b,"undefined"==typeof a||i(a),"Plain Object")},k=function(a,b){f(a,b,"string"==typeof a,"a string")},l=function(a,b){if(g(a)&&(a=a.join("/")),"string"!=typeof a)throw new Error('invalid path "'+a+'"');return a=a.replace(/^\//,"").replace(/^cldr\//,""),a=a.replace(/{[a-zA-Z]+}/g,function(a){return a=a.replace(/^{([^}]*)}$/,"$1"),b[a]}),a.split("/")},m=function(a,b){var c,d;if(a.some)return a.some(b);for(c=0,d=a.length;d>c;c++)if(b(a[c],c,a))return!0;return!1},n=function(a,b,c,d){var e,f,g=c[0],h=c[1],i=a.localeSep,j=c[2];return d=d||{},"und"!==g&&"Zzzz"!==h&&"ZZ"!==j?[g,h,j]:"undefined"!=typeof b.get("supplemental/likelySubtags")?(f=m([[g,h,j],[g,j],[g,h],[g],["und",h]],function(a){return e=!/\b(Zzzz|ZZ)\b/.test(a.join(i))&&b.get(["supplemental/likelySubtags",a.join(i)])}),f?(e=e.split(i),["und"!==g?g:e[0],"Zzzz"!==h?h:e[1],"ZZ"!==j?j:e[2]]):d.force?b.get("supplemental/likelySubtags/und").split(i):void 0):void 0},o=function(a,b,c){var d,e,f=c[0],g=c[1],h=c[2];return e=m([[[f,"Zzzz","ZZ"],[f]],[[f,"Zzzz",h],[f,h]],[[f,g,"ZZ"],[f,g]]],function(e){var f=n(a,b,e[0]);return d=e[1],f&&f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}),e?d:c},p=function(a,b){var c,d=a,e=b.length;for(c=0;e-1>c;c++)if(d=d[b[c]],!d)return void 0;return d[b[c]]},q=function(a,b,c){var d=l(b,c);return p(a._resolved,d)},r=function(a){return"string"==typeof a?[a]:a},s=function(){var b=function(){var c={},d=[].slice.call(arguments,0);return a(d,function(a){var d;for(d in a)c[d]=d in c&&g(c[d])?c[d].concat(a[d]):d in c&&"object"==typeof c[d]?b(c[d],a[d]):a[d]}),c};return b}(),t=function(a){this.init(a)};return t._alwaysArray=r,t._createError=c,t._itemGetResolved=q,t._jsonMerge=s,t._pathNormalize=l,t._resourceGet=p,t._validatePresence=e,t._validateType=f,t._validateTypePath=h,t._validateTypePlainObject=j,t._resolved={},t.localeSep="-",t.load=function(a){e(a,"json"),j(a,"json"),t._resolved=s(t._resolved,a)},t.prototype.init=function(a){var b,c,d,f,g,h,i,j=t.localeSep;switch(e(a,"locale"),k(a,"locale"),a=a.replace(/-/,"_"),a=a.split("_u_")[0],a=a.split("_t_")[0],h=a,!0){case/^[a-z]{2,3}_[A-Z][a-z]{3}_[A-Z0-9]{2}(\b|_)/.test(h):b=h.split("_")[0],f=h.split("_")[1],g=h.split("_")[2],i=h.split("_")[3];break;case/^[a-z]{2,3}_[A-Z][a-z]{3}(\b|_)/.test(h):b=h.split("_")[0],f=h.split("_")[1],g="ZZ",i=h.split("_")[2];break;case/^[a-z]{2,3}_[A-Z0-9]{2}(\b|_)/.test(h):b=h.split("_")[0],f="Zzzz",g=h.split("_")[1],i=h.split("_")[2];break;case/^([a-z]{2,3}|root)(\b|_)/.test(h):b=h.split("_")[0],f="Zzzz",g="ZZ",i=h.split("_")[1];break;default:b="und",f="Zzzz",g="ZZ"}d=n(t,this,[b,f,g],{force:!0})||h.split("_"),b=d[0],f=d[1],g=d[2],c=o(t,this,d).join(j),this.attributes={languageId:c,maxLanguageId:d.join(j),language:b,script:f,territory:g,region:g,variant:i},this.locale=i?[c,i].join(j):c},t.prototype.get=function(a){return e(a,"path"),h(a,"path"),q(t,a,this.attributes)},t.prototype.main=function(a){return e(a,"path"),h(a,"path"),a=r(a),this.get(["main/{languageId}"].concat(a))},t});
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&"object"==typeof module.exports?module.exports=b():a.Cldr=b()}(this,function(){var a=function(a,b){var c,d;if(a.forEach)return a.forEach(b);for(c=0,d=a.length;d>c;c++)b(a[c],c,a)},b=function(a){var b,c=[];if(Object.keys)return Object.keys(a);for(b in a)c.push(b);return c},c=function(c,d){var e,f;return f=c+(d&&JSON?": "+JSON.stringify(d):""),e=new Error(f),e.code=c,a(b(d),function(a){e[a]=d[a]}),e},d=function(a,b,d){if(!b)throw c(a,d)},e=function(a,b){d("E_MISSING_PARAMETER","undefined"!=typeof a,{name:b})},f=function(a,b,c,e){d("E_INVALID_PAR_TYPE",c,{expected:e,name:b,value:a})},g=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},h=function(a,b){f(a,b,"string"==typeof a||g(a),"String or Array")},i=function(a){return null!==a&&""+a=="[object Object]"},j=function(a,b){f(a,b,"undefined"==typeof a||i(a),"Plain Object")},k=function(a,b){f(a,b,"string"==typeof a,"a string")},l=function(a,b){if(g(a)&&(a=a.join("/")),"string"!=typeof a)throw new Error('invalid path "'+a+'"');return a=a.replace(/^\//,"").replace(/^cldr\//,""),a=a.replace(/{[a-zA-Z]+}/g,function(a){return a=a.replace(/^{([^}]*)}$/,"$1"),b[a]}),a.split("/")},m=function(a,b){var c,d;if(a.some)return a.some(b);for(c=0,d=a.length;d>c;c++)if(b(a[c],c,a))return!0;return!1},n=function(a,b,c,d){var e,f,g=c[0],h=c[1],i=a.localeSep,j=c[2];return d=d||{},"und"!==g&&"Zzzz"!==h&&"ZZ"!==j?[g,h,j]:"undefined"!=typeof b.get("supplemental/likelySubtags")?(f=m([[g,h,j],[g,j],[g,h],[g],["und",h]],function(a){return e=!/\b(Zzzz|ZZ)\b/.test(a.join(i))&&b.get(["supplemental/likelySubtags",a.join(i)])}),f?(e=e.split(i),["und"!==g?g:e[0],"Zzzz"!==h?h:e[1],"ZZ"!==j?j:e[2]]):d.force?b.get("supplemental/likelySubtags/und").split(i):void 0):void 0},o=function(a,b,c){var d,e,f=c[0],g=c[1],h=c[2];return e=m([[[f,"Zzzz","ZZ"],[f]],[[f,"Zzzz",h],[f,h]],[[f,g,"ZZ"],[f,g]]],function(e){var f=n(a,b,e[0]);return d=e[1],f&&f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}),e?d:c},p=function(a,b){var c,d=a,e=b.length;for(c=0;e-1>c;c++)if(d=d[b[c]],!d)return void 0;return d[b[c]]},q=function(a,b,c){var d=l(b,c);return p(a._resolved,d)},r=function(a){return g(a)?a:[a]},s=function(){var b=function(){var c={},d=[].slice.call(arguments,0);return a(d,function(a){var d;for(d in a)c[d]=d in c&&g(c[d])?c[d].concat(a[d]):d in c&&"object"==typeof c[d]?b(c[d],a[d]):a[d]}),c};return b}(),t=function(a){this.init(a)};return t._alwaysArray=r,t._createError=c,t._itemGetResolved=q,t._jsonMerge=s,t._pathNormalize=l,t._resourceGet=p,t._validatePresence=e,t._validateType=f,t._validateTypePath=h,t._validateTypePlainObject=j,t._resolved={},t.localeSep="-",t.load=function(a){var b,c;for(e(a,"json"),b=0;b<arguments.length;b++)for(a=r(arguments[b]),c=0;c<a.length;c++)j(a[c],"json"),t._resolved=s(t._resolved,a[c])},t.prototype.init=function(a){var b,c,d,f,g,h,i,j=t.localeSep;switch(e(a,"locale"),k(a,"locale"),a=a.replace(/-/,"_"),a=a.split("_u_")[0],a=a.split("_t_")[0],h=a,!0){case/^[a-z]{2,3}_[A-Z][a-z]{3}_[A-Z0-9]{2}(\b|_)/.test(h):b=h.split("_")[0],f=h.split("_")[1],g=h.split("_")[2],i=h.split("_")[3];break;case/^[a-z]{2,3}_[A-Z][a-z]{3}(\b|_)/.test(h):b=h.split("_")[0],f=h.split("_")[1],g="ZZ",i=h.split("_")[2];break;case/^[a-z]{2,3}_[A-Z0-9]{2}(\b|_)/.test(h):b=h.split("_")[0],f="Zzzz",g=h.split("_")[1],i=h.split("_")[2];break;case/^([a-z]{2,3}|root)(\b|_)/.test(h):b=h.split("_")[0],f="Zzzz",g="ZZ",i=h.split("_")[1];break;default:b="und",f="Zzzz",g="ZZ"}d=n(t,this,[b,f,g],{force:!0})||h.split("_"),b=d[0],f=d[1],g=d[2],c=o(t,this,d).join(j),this.attributes={languageId:c,maxLanguageId:d.join(j),language:b,script:f,territory:g,region:g,variant:i},this.locale=i?[c,i].join(j):c},t.prototype.get=function(a){return e(a,"path"),h(a,"path"),q(t,a,this.attributes)},t.prototype.main=function(a){return e(a,"path"),h(a,"path"),a=r(a),this.get(["main/{languageId}"].concat(a))},t});
/**
* CLDR JavaScript Library v0.3.8
* CLDR JavaScript Library v0.3.9
* http://jquery.com/

@@ -9,6 +9,6 @@ *

*
* Date: 2014-07-13T05:05Z
* Date: 2014-10-14T21:16Z
*/
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg

@@ -36,3 +36,2 @@ */

/*!

@@ -587,2 +586,3 @@ * EventEmitter v4.2.7 - git.io/ee

}));
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg
*/
!function(a){"function"==typeof define&&define.amd?define(["../cldr"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("cldrjs")):a(Cldr)}(function(a){function b(a,b){k(a,b,"string"==typeof a||a instanceof RegExp,"String or RegExp")}function c(a,c){return function(d,e){return j(d,"event"),b(d,"event"),j(e,"listener"),n(e,"listener"),c[a].apply(c,arguments)}}function d(a){return c("off",a)}function e(a){return c("on",a)}function f(a){return c("once",a)}function g(){l=a.prototype.get,a.prototype.get=function(a){var b=l.apply(this,arguments);return a=i(a,this.attributes).join("/"),o.trigger("get",[a,b]),this.ee.trigger("get",[a,b]),b}}var h,i=a._pathNormalize,j=a._validatePresence,k=a._validateType;h=function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;return d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if(a instanceof RegExp)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},a}();var l,m,n=function(a,b){k(a,b,"undefined"==typeof a||"function"==typeof a,"Function")},o=new h;return a.off=d(o),a.on=e(o),a.once=f(o),m=a.prototype.init,a.prototype.init=function(){var a;this.ee=a=new h,this.off=d(a),this.on=e(a),this.once=f(a),m.apply(this,arguments)},a._eventInit=g,g(),a});
/**
* CLDR JavaScript Library v0.3.8
* CLDR JavaScript Library v0.3.9
* http://jquery.com/

@@ -9,6 +9,6 @@ *

*
* Date: 2014-07-13T05:05Z
* Date: 2014-10-14T21:16Z
*/
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg

@@ -36,3 +36,2 @@ */

var supplementalMain = function( cldr ) {

@@ -103,2 +102,3 @@

}));
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg
*/
!function(a){"function"==typeof define&&define.amd?define(["../cldr"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("cldrjs")):a(Cldr)}(function(a){var b=a._alwaysArray,c=function(a){var c,d;return c=function(c){return function(d){return d=b(d),a.get([c].concat(d))}},d=c("supplemental"),d.weekData=c("supplemental/weekData"),d.weekData.firstDay=function(){return a.get("supplemental/weekData/firstDay/{territory}")||a.get("supplemental/weekData/firstDay/001")},d.weekData.minDays=function(){var b=a.get("supplemental/weekData/minDays/{territory}")||a.get("supplemental/weekData/minDays/001");return parseInt(b,10)},d.timeData=c("supplemental/timeData"),d.timeData.allowed=function(){return a.get("supplemental/timeData/{territory}/_allowed")||a.get("supplemental/timeData/001/_allowed")},d.timeData.preferred=function(){return a.get("supplemental/timeData/{territory}/_preferred")||a.get("supplemental/timeData/001/_preferred")},d},d=a.prototype.init;return a.prototype.init=function(){d.apply(this,arguments),this.supplemental=c(this)},a});
/**
* CLDR JavaScript Library v0.3.8
* CLDR JavaScript Library v0.3.9
* http://jquery.com/

@@ -9,6 +9,6 @@ *

*
* Date: 2014-07-13T05:05Z
* Date: 2014-10-14T21:16Z
*/
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg

@@ -32,2 +32,3 @@ */

// Build optimization hack to avoid duplicating functions across modules.
var alwaysArray = Cldr._alwaysArray;
var jsonMerge = Cldr._jsonMerge;

@@ -42,3 +43,2 @@ var pathNormalize = Cldr._pathNormalize;

var bundleParentLookup = function( Cldr, locale ) {

@@ -141,5 +141,17 @@ var normalizedPath, parent;

Cldr.load = function( json ) {
var i, j;
validatePresence( json, "json" );
validateTypePlainObject( json, "json" );
Cldr._raw = jsonMerge( Cldr._raw, json );
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
for ( i = 0; i < arguments.length; i++ ) {
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
json = alwaysArray( arguments[ i ] );
for ( j = 0; j < json.length; j++ ) {
validateTypePlainObject( json[ j ], "json" );
Cldr._raw = jsonMerge( Cldr._raw, json[ j ] );
}
}
};

@@ -168,2 +180,3 @@

}));
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg
*/
!function(a){"function"==typeof define&&define.amd?define(["../cldr"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("cldrjs")):a(Cldr)}(function(a){var b=a._jsonMerge,c=a._pathNormalize,d=a._resourceGet,e=a._validatePresence,f=a._validateTypePath,g=a._validateTypePlainObject,h=function(a,b){var e,f;if("root"!==b)return e=c(["supplemental/parentLocales/parentLocale",b]),(f=d(a._resolved,e)||d(a._raw,e))?f:(f=b.substr(0,b.lastIndexOf(a.localeSep)),f?f:"root")},i=function(a,b,c){var d,e=a,f=b.length;for(d=0;f-1>d;d++)e[b[d]]||(e[b[d]]={}),e=e[b[d]];e[b[d]]=c},j=function(){var a;return a=function(e,f,g,j,k){var l,m,n;if("undefined"!=typeof f&&f!==k)return l=c(g,j),n=d(e._resolved,l),n&&"object"!=typeof n?n:(n=d(e._raw,l),n||(m=h(e,f),n=a(e,m,g,b(j,{languageId:m}),f)),n&&i(e._resolved,l,n),n)}}();return a._raw={},a.load=function(c){e(c,"json"),g(c,"json"),a._raw=b(a._raw,c)},a.prototype.get=function(b){return e(b,"path"),f(b,"path"),j(a,this.attributes&&this.attributes.languageId||"",b,this.attributes)},a._eventInit&&a._eventInit(),a});
!function(a){"function"==typeof define&&define.amd?define(["../cldr"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("cldrjs")):a(Cldr)}(function(a){var b=a._alwaysArray,c=a._jsonMerge,d=a._pathNormalize,e=a._resourceGet,f=a._validatePresence,g=a._validateTypePath,h=a._validateTypePlainObject,i=function(a,b){var c,f;if("root"!==b)return c=d(["supplemental/parentLocales/parentLocale",b]),(f=e(a._resolved,c)||e(a._raw,c))?f:(f=b.substr(0,b.lastIndexOf(a.localeSep)),f?f:"root")},j=function(a,b,c){var d,e=a,f=b.length;for(d=0;f-1>d;d++)e[b[d]]||(e[b[d]]={}),e=e[b[d]];e[b[d]]=c},k=function(){var a;return a=function(b,f,g,h,k){var l,m,n;if("undefined"!=typeof f&&f!==k)return l=d(g,h),n=e(b._resolved,l),n&&"object"!=typeof n?n:(n=e(b._raw,l),n||(m=i(b,f),n=a(b,m,g,c(h,{languageId:m}),f)),n&&j(b._resolved,l,n),n)}}();return a._raw={},a.load=function(d){var e,g;for(f(d,"json"),e=0;e<arguments.length;e++)for(d=b(arguments[e]),g=0;g<d.length;g++)h(d[g],"json"),a._raw=c(a._raw,d[g])},a.prototype.get=function(b){return f(b,"path"),g(b,"path"),k(a,this.attributes&&this.attributes.languageId||"",b,this.attributes)},a._eventInit&&a._eventInit(),a});
/**
* CLDR JavaScript Library v0.3.8
* CLDR JavaScript Library v0.3.9
* http://jquery.com/

@@ -9,6 +9,6 @@ *

*
* Date: 2014-07-13T05:05Z
* Date: 2014-10-14T21:16Z
*/
/*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
* CLDR JavaScript Library v0.3.9 2014-10-14T21:16Z MIT license © Rafael Xavier
* http://git.io/h4lmVg

@@ -15,0 +15,0 @@ */

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

## Cldr.load( json )
## Cldr.load( json, ... )

@@ -3,0 +3,0 @@ Load resolved or unresolved [1] JSON data.

@@ -79,2 +79,11 @@ module.exports = function(grunt) {

},
dco: {
current: {
options: {
exceptionalAuthors: {
"rxaviers@gmail.com": "Rafael Xavier de Souza"
}
}
}
},
mocha: {

@@ -279,3 +288,4 @@ unit: {

"uglify",
"compare_size"
"compare_size",
"dco"
]);

@@ -282,0 +292,0 @@

{
"name": "cldrjs",
"version": "0.3.8",
"version": "0.3.9",
"description": "Simple CLDR API",

@@ -25,3 +25,3 @@ "keywords": [

"type": "git",
"url": "git://github.com/rxaviers/cldr.git"
"url": "git://github.com/rxaviers/cldrjs.git"
},

@@ -37,3 +37,3 @@ "readmeFilename": "README.md",

"type": "MIT",
"url": "https://github.com/jzaefferer/grunt-css/blob/master/LICENSE-MIT"
"url": "https://github.com/rxaviers/cldrjs/blob/master/LICENSE-MIT"
}

@@ -49,2 +49,3 @@ ],

"grunt-contrib-uglify": "0.2.x",
"grunt-dco": "0.0.3",
"gzip-js": "0.3.2",

@@ -51,0 +52,0 @@ "grunt-mocha": "0.3.x",

@@ -10,3 +10,3 @@ # cldr.js - Simple CLDR API

| cldr/supplemental.js | +0.5KB | Provides supplemental helper methods |
| cldr/unresolved.js | +0.6KB | Provides inheritance support for unresolved data |
| cldr/unresolved.js | +0.7KB | Provides inheritance support for unresolved data |

@@ -41,5 +41,7 @@ Quick jump:

// Load the appropriate portion of CLDR JSON data
Cldr.load( likelySubtagsData );
Cldr.load( enData );
Cldr.load( ptBrData );
Cldr.load(
likelySubtagsData,
enData,
ptBrData
);
```

@@ -134,7 +136,9 @@

```javascript
Cldr.load( unresolvedEnData );
Cldr.load( unresolvedEnGbData );
Cldr.load( unresolvedEnInData );
Cldr.load( parentLocalesData ); // supplemental
Cldr.load( likelySubtagsData ); // supplemental
Cldr.load(
unresolvedEnData
unresolvedEnGbData,
unresolvedEnInData,
parentLocalesData, // supplemental
likelySubtagsData // supplemental
);

@@ -327,3 +331,3 @@ var enIn = new Cldr( "en-IN" );

- **`Cldr.load( json )`**
- **`Cldr.load( json, ... )`**

@@ -330,0 +334,0 @@ Load resolved or unresolved [1] JSON data.

@@ -31,2 +31,3 @@ /**

// Build optimization hack to avoid duplicating functions across modules.
var alwaysArray = Cldr._alwaysArray;
var jsonMerge = Cldr._jsonMerge;

@@ -33,0 +34,0 @@ var pathNormalize = Cldr._pathNormalize;

@@ -45,5 +45,17 @@ define([

Cldr.load = function( json ) {
var i, j;
validatePresence( json, "json" );
validateTypePlainObject( json, "json" );
Cldr._resolved = jsonMerge( Cldr._resolved, json );
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
for ( i = 0; i < arguments.length; i++ ) {
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
json = alwaysArray( arguments[ i ] );
for ( j = 0; j < json.length; j++ ) {
validateTypePlainObject( json[ j ], "json" );
Cldr._resolved = jsonMerge( Cldr._resolved, json[ j ] );
}
}
};

@@ -50,0 +62,0 @@

@@ -7,4 +7,5 @@ define([

"./item/lookup",
"./util/always_array",
"./util/json/merge"
], function( validatePresence, validateTypePath, validateTypePlainObject, Cldr, itemLookup, jsonMerge ) {
], function( validatePresence, validateTypePath, validateTypePlainObject, Cldr, itemLookup, alwaysArray, jsonMerge ) {

@@ -20,5 +21,17 @@ Cldr._raw = {};

Cldr.load = function( json ) {
var i, j;
validatePresence( json, "json" );
validateTypePlainObject( json, "json" );
Cldr._raw = jsonMerge( Cldr._raw, json );
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
for ( i = 0; i < arguments.length; i++ ) {
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
json = alwaysArray( arguments[ i ] );
for ( j = 0; j < json.length; j++ ) {
validateTypePlainObject( json[ j ], "json" );
Cldr._raw = jsonMerge( Cldr._raw, json[ j ] );
}
}
};

@@ -25,0 +38,0 @@

@@ -1,7 +0,9 @@

define(function() {
define([
"./array/is_array"
], function( arrayIsArray ) {
return function( stringOrArray ) {
return typeof stringOrArray === "string" ? [ stringOrArray ] : stringOrArray;
return function( somethingOrArray ) {
return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
};
});

@@ -8,6 +8,48 @@ define([

Cldr.load( enNumbersJson );
Cldr.load( likelySubtagsJson );
var isLoaded;
function cldrLoad() {
if ( isLoaded ) {
return;
}
Cldr.load( enNumbersJson, likelySubtagsJson );
isLoaded = true;
}
describe( "Cldr.load( json )", function() {
it( "should throw error on missing json parameter", function() {
expect(function() {
Cldr.load();
}).to.throw( Error, /E_MISSING_PARAMETER/ );
});
it( "should throw error on invalid locale parameter type", function() {
util.assertObjectParameter( expect, function( invalidValue ) {
return function() {
Cldr.load( invalidValue );
};
});
});
it( "should throw error on invalid locale parameter type", function() {
util.assertObjectParameter( expect, function( invalidValue ) {
return function() {
Cldr.load([ { a: 1 }, invalidValue ]);
};
});
});
it( "should throw error on invalid locale parameter type", function() {
util.assertObjectParameter( expect, function( invalidValue ) {
return function() {
Cldr.load( { a: 1 }, invalidValue );
};
});
});
});
describe( "new Cldr( locale )", function() {
cldrLoad();

@@ -31,3 +73,5 @@ it( "should throw error on missing locale parameter", function() {

describe( ".get( path )", function() {
var cldr = new Cldr( "en" );
var cldr;
cldrLoad();
cldr = new Cldr( "en" );

@@ -45,3 +89,5 @@ it( "should throw error on invalid parameter type", function() {

describe( ".main( path )", function() {
var cldr = new Cldr( "en" );
var cldr;
cldrLoad();
cldr = new Cldr( "en" );

@@ -48,0 +94,0 @@ it( "should throw error on invalid parameter type", function() {

@@ -7,4 +7,3 @@ define([

Cldr.load( enNumbersJson );
Cldr.load( likelySubtagsJson );
Cldr.load( enNumbersJson, likelySubtagsJson );

@@ -11,0 +10,0 @@ describe( "Cldr (core)", function() {

@@ -10,11 +10,13 @@ define([

Cldr.load( genderJson );
Cldr.load( likelySubtagsJson );
Cldr.load( ptNumbersJson );
Cldr.load({
"lookup-test": {
a: 1,
b: 2
Cldr.load(
genderJson,
likelySubtagsJson,
ptNumbersJson,
{
"lookup-test": {
a: 1,
b: 2
}
}
});
);

@@ -21,0 +23,0 @@ describe( "Item Lookup", function() {

@@ -9,5 +9,7 @@ define([

Cldr.load( likelySubtagsJson );
Cldr.load( timeDataJson );
Cldr.load( weekDataJson );
Cldr.load(
likelySubtagsJson,
timeDataJson,
weekDataJson
);

@@ -14,0 +16,0 @@ describe( "Supplemental", function() {

define(function() {
var allTypes = {
array: [],
array: [ 7 ],
date: new Date(),

@@ -57,2 +57,6 @@ "function": function() {},

assertObjectParameter: function( expect, fn ) {
assertParameterType( expect, [ "object", "plainObject" ], fn );
},
assertStringParameter: function( expect, fn ) {

@@ -59,0 +63,0 @@ assertParameterType( expect, [ "string" ], fn );

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