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

i18njs

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18njs - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

15

bin/bowerSync.js

@@ -16,9 +16,10 @@ var fs = require('fs');

console.log('commiting changes to bower.json');
exec('git add bower.json && git commit -m "chore: bower bump"', function (err) {
if (!err) {
process.exit(0);
}
console.error(err);
process.exit(1);
});
exec('git add bower.json && git commit -m "chore: bower bump"',
function (err) {
if (!err) {
process.exit(0);
}
console.error(err);
process.exit(1);
});
});

@@ -0,0 +0,0 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.templateI18N = f()}})(function(){var define,module,exports;

{
"name": "i18njs",
"main": "i18njs.js",
"version": "2.1.1",
"version": "2.1.2",
"homepage": "https://github.com/yoannmoinet/i18njs",

@@ -6,0 +6,0 @@ "authors": [

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

<a name="2.1.1"></a>
## 2.1.1 (2015-09-25)
<a name="2.1.2"></a>
## [2.1.2](https://github.com/yoannmoinet/i18njs/compare/v2.1.2...v2.1.2) (2015-10-06)

@@ -7,4 +7,14 @@

<a name="2.1.2"></a>
## [2.1.2](https://github.com/yoannmoinet/i18njs/compare/v2.1.1...v2.1.2) (2015-10-06)
### Bug Fixes
* **defaults:** let get defaults without templated locales ([96e4677](https://github.com/yoannmoinet/i18njs/commit/96e4677))
<a name="2.1.1"></a>
## 2.1.1 (2015-09-25)
## [2.1.1](https://github.com/yoannmoinet/i18njs/compare/v2.1.0...v2.1.1) (2015-09-25)

@@ -15,3 +25,3 @@

<a name="2.1.0"></a>
# 2.1.0 (2015-08-09)
# [2.1.0](https://github.com/yoannmoinet/i18njs/compare/v2.0.7...v2.1.0) (2015-08-09)

@@ -22,3 +32,3 @@

<a name="2.0.7"></a>
## 2.0.7 (2015-08-09)
## [2.0.7](https://github.com/yoannmoinet/i18njs/compare/v2.0.6...v2.0.7) (2015-08-09)

@@ -33,3 +43,3 @@

<a name="2.0.6"></a>
## 2.0.6 (2015-08-09)
## [2.0.6](https://github.com/yoannmoinet/i18njs/compare/v2.0.5...v2.0.6) (2015-08-09)

@@ -46,3 +56,3 @@

<a name="2.0.5"></a>
## 2.0.5 (2015-08-08)
## [2.0.5](https://github.com/yoannmoinet/i18njs/compare/v2.0.4...v2.0.5) (2015-08-08)

@@ -57,3 +67,3 @@

<a name="2.0.4"></a>
## 2.0.4 (2015-08-08)
## [2.0.4](https://github.com/yoannmoinet/i18njs/compare/v2.0.3...v2.0.4) (2015-08-08)

@@ -73,3 +83,3 @@

<a name="2.0.3"></a>
## 2.0.3 (2015-08-03)
## [2.0.3](https://github.com/yoannmoinet/i18njs/compare/v2.0.2...v2.0.3) (2015-08-03)

@@ -80,3 +90,3 @@

<a name="2.0.2"></a>
## 2.0.2 (2015-08-03)
## [2.0.2](https://github.com/yoannmoinet/i18njs/compare/v2.0.1...v2.0.2) (2015-08-03)

@@ -91,3 +101,3 @@

<a name="2.0.1"></a>
## 2.0.1 (2015-07-26)
## [2.0.1](https://github.com/yoannmoinet/i18njs/compare/v2.0.0...v2.0.1) (2015-07-26)

@@ -111,3 +121,3 @@

<a name="2.0.0"></a>
# 2.0.0 (2015-06-28)
# [2.0.0](https://github.com/yoannmoinet/i18njs/compare/v1.6.0...v2.0.0) (2015-06-28)

@@ -131,3 +141,3 @@

<a name="1.6.0"></a>
# 1.6.0 (2015-06-05)
# [1.6.0](https://github.com/yoannmoinet/i18njs/compare/v1.5.0...v1.6.0) (2015-06-05)

@@ -142,3 +152,3 @@

<a name="1.5.0"></a>
# 1.5.0 (2015-06-04)
# [1.5.0](https://github.com/yoannmoinet/i18njs/compare/v1.4.1...v1.5.0) (2015-06-04)

@@ -153,3 +163,3 @@

<a name="1.4.1"></a>
## 1.4.1 (2015-06-04)
## [1.4.1](https://github.com/yoannmoinet/i18njs/compare/v1.4.0...v1.4.1) (2015-06-04)

@@ -164,3 +174,3 @@

<a name="1.4.0"></a>
# 1.4.0 (2015-04-15)
# [1.4.0](https://github.com/yoannmoinet/i18njs/compare/v1.2.0...v1.4.0) (2015-04-15)

@@ -181,3 +191,3 @@

<a name="1.2.0"></a>
# 1.2.0 (2015-04-08)
# [1.2.0](https://github.com/yoannmoinet/i18njs/compare/v1.1.0...v1.2.0) (2015-04-08)

@@ -192,3 +202,3 @@

<a name="1.1.0"></a>
# 1.1.0 (2015-04-06)
# [1.1.0](https://github.com/yoannmoinet/i18njs/compare/v1.0.1...v1.1.0) (2015-04-06)

@@ -203,3 +213,3 @@

<a name="1.0.1"></a>
## 1.0.1 (2015-04-06)
## [1.0.1](https://github.com/yoannmoinet/i18njs/compare/v1.0.0...v1.0.1) (2015-04-06)

@@ -210,3 +220,3 @@

<a name="1.0.0"></a>
# 1.0.0 (2015-04-06)
# [1.0.0](https://github.com/yoannmoinet/i18njs/compare/5a6af04...v1.0.0) (2015-04-06)

@@ -213,0 +223,0 @@

@@ -119,2 +119,16 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.i18njs = f()}})(function(){var define,module,exports;

var extend = function (objA, objB) {
'use strict';
for (var i in objB) {
if (objB.hasOwnProperty(i)) {
if (objA.hasOwnProperty(i) && typeof objA[i] === 'object') {
objA[i] = extend(objB[i]);
} else {
objA[i] = objB[i];
}
}
}
return objA;
};
var I18n = function () {

@@ -184,2 +198,6 @@ 'use strict';

this.getDefaults = function () {
return defaults;
};
this.setLang = function (lang) {

@@ -191,3 +209,3 @@ localLang = lang;

this.setDefaults = function (options) {
defaults = options || {};
defaults = extend(defaults, options || {});
};

@@ -207,4 +225,5 @@

var obj = parse(lng + '.' + key, dico);
var obj = parse(lng + '.' + key, defaults) ||
parse(key, defaults) ||
parse(lng + '.' + key, dico);
options = options || {};

@@ -211,0 +230,0 @@

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.i18njs=t()}}(function(){var t=/(.)^/,n=/\\|'|\r|\n|\u2028|\u2029/g,e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},r={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},i=function(t){"use strict";var n=function(n){return t[n]},e="(?:"+Object.keys(t).join("|")+")",r=RegExp(e),i=RegExp(e,"g");return function(t){return t=null==t?"":""+t,r.test(t)?t.replace(i,n):t}},o=function(t){"use strict";return"\\"+r[t]},u=function(r,u){"use strict";var s=0,a="__p+='",f=RegExp([(u.escape||t).source,(u.interpolate||t).source,(u.evaluate||t).source].join("|")+"|$","g");r.replace(f,function(t,e,i,u,f){return a+=r.slice(s,f).replace(n,o),s=f+t.length,e?a+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'":i?a+="'+\n((__t=("+i+"))==null?'':__t)+\n'":u&&(a+="';\n"+u+"\n__p+='"),t}),a+="';\n",a="with(obj||{}){\n"+a+"}\n",a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var c=new Function("obj","_",a)}catch(p){throw p.source=a,p}var l=function(t){return c.call(this,t,{escape:i(e)})};return l.source="function (data) {\n return "+c.toString()+".call(this, data, {\n escape:"+i.toString()+".call(this, { '&': '&amp;', '<': '&lt;', '>': '&gt;','\"': '&quot;', \"'\": '&#x27;','`': '&#x60;'})})}",l},s=function(t,n){"use strict";for(var e=t.split(".");n&&e.length;)n=n[e.shift()];return n},a=function(){"use strict";var t="en",n={},e={},r=/\{\{([\s\S]+?)\}\}/g,i=/\{\{=([\s\S]+?)\}\}/g,o=/\{\{-([\s\S]+?)\}\}/g;this.add=function(t,e,r){var i,o;n[t]=n[t]||{},void 0===r?(r=e,e=void 0,o=n[t]):(n[t][e]=n[t][e]||{},o=n[t][e]);for(i in r)r.hasOwnProperty(i)&&(o[i]=r[i])},this.has=function(e,r){r=r||t;var i=r+"."+e;return n[e]?!0:s(i,n)?!0:!1},this.listLangs=function(){var t=[];for(var e in n)t.push(e);return t},this.getCurrentLang=function(){return t},this.getDico=function(){return n},this.setLang=function(n){return t=n},this.setDefaults=function(t){e=t||{}},this.get=function(a,f,c,p){var l=p||t;void 0===p&&("string"==typeof f?(l=f,f=void 0):"string"==typeof c&&(l=c));var g=s(l+"."+a,n);if(c=c||{},"string"==typeof g||"function"==typeof g){var _,d={evaluate:c.evaluate||r,interpolate:c.interpolate||i,escape:c.escape||o},h={},v=e[t]||e;for(_ in v)v.hasOwnProperty(_)&&(h[_]=v[_]);for(_ in f)f.hasOwnProperty(_)&&(h[_]=f[_]);return"function"!=typeof g&&"function"==typeof u&&(g=u(g,d)),g(h)}return"object"==typeof g?g:a}};return new a});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.i18njs=t()}}(function(){var t=/(.)^/,n=/\\|'|\r|\n|\u2028|\u2029/g,e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},r={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},o=function(t){"use strict";var n=function(n){return t[n]},e="(?:"+Object.keys(t).join("|")+")",r=RegExp(e),o=RegExp(e,"g");return function(t){return t=null==t?"":""+t,r.test(t)?t.replace(o,n):t}},i=function(t){"use strict";return"\\"+r[t]},u=function(r,u){"use strict";var s=0,a="__p+='",f=RegExp([(u.escape||t).source,(u.interpolate||t).source,(u.evaluate||t).source].join("|")+"|$","g");r.replace(f,function(t,e,o,u,f){return a+=r.slice(s,f).replace(n,i),s=f+t.length,e?a+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'":o?a+="'+\n((__t=("+o+"))==null?'':__t)+\n'":u&&(a+="';\n"+u+"\n__p+='"),t}),a+="';\n",a="with(obj||{}){\n"+a+"}\n",a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var c=new Function("obj","_",a)}catch(p){throw p.source=a,p}var l=function(t){return c.call(this,t,{escape:o(e)})};return l.source="function (data) {\n return "+c.toString()+".call(this, data, {\n escape:"+o.toString()+".call(this, { '&': '&amp;', '<': '&lt;', '>': '&gt;','\"': '&quot;', \"'\": '&#x27;','`': '&#x60;'})})}",l},s=function(t,n){"use strict";for(var e=t.split(".");n&&e.length;)n=n[e.shift()];return n},a=function(t,n){"use strict";for(var e in n)n.hasOwnProperty(e)&&(t.hasOwnProperty(e)&&"object"==typeof t[e]?t[e]=a(n[e]):t[e]=n[e]);return t},f=function(){"use strict";var t="en",n={},e={},r=/\{\{([\s\S]+?)\}\}/g,o=/\{\{=([\s\S]+?)\}\}/g,i=/\{\{-([\s\S]+?)\}\}/g;this.add=function(t,e,r){var o,i;n[t]=n[t]||{},void 0===r?(r=e,e=void 0,i=n[t]):(n[t][e]=n[t][e]||{},i=n[t][e]);for(o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},this.has=function(e,r){r=r||t;var o=r+"."+e;return n[e]?!0:s(o,n)?!0:!1},this.listLangs=function(){var t=[];for(var e in n)t.push(e);return t},this.getCurrentLang=function(){return t},this.getDico=function(){return n},this.getDefaults=function(){return e},this.setLang=function(n){return t=n},this.setDefaults=function(t){e=a(e,t||{})},this.get=function(a,f,c,p){var l=p||t;void 0===p&&("string"==typeof f?(l=f,f=void 0):"string"==typeof c&&(l=c));var g=s(l+"."+a,e)||s(a,e)||s(l+"."+a,n);if(c=c||{},"string"==typeof g||"function"==typeof g){var h,_={evaluate:c.evaluate||r,interpolate:c.interpolate||o,escape:c.escape||i},d={},v=e[t]||e;for(h in v)v.hasOwnProperty(h)&&(d[h]=v[h]);for(h in f)f.hasOwnProperty(h)&&(d[h]=f[h]);return"function"!=typeof g&&"function"==typeof u&&(g=u(g,_)),g(d)}return"object"==typeof g?g:a}};return new f});
{
"name": "i18njs",
"version": "2.1.1",
"version": "2.1.2",
"description": "Simplistic I18N tool for universal/isomorphic Javascript.",

@@ -44,7 +44,7 @@ "main": "dist/i18njs.js",

"devDependencies": {
"concat-cli": "yoannmoinet/concat-cli",
"conventional-changelog": "0.2.1",
"concat-cli": "^1.0.*",
"conventional-changelog": "0.4.3",
"eslint": "^0.24.1",
"expect.js": "^0.3.1",
"jscs": "^1.13.1",
"jscs": "^2.1.*",
"mocha": "^2.2.5",

@@ -51,0 +51,0 @@ "uglify-js": "^2.4.24",

@@ -256,4 +256,6 @@ ![logo](./dist/logo.png)

i18n.get('welcome')
i18n.get('welcome');
//Welcome to My Brand
i18n.get('brand');
// My Brand
```

@@ -274,1 +276,16 @@

```
You can also check your defaults :
```javascript
i18n.getDefaults();
//{
// brand: 'My Brand',
// fr: {
// brand: 'Ma Marque'
// },
// en: {
// brand: 'My Brand'
// }
//}
```

@@ -13,2 +13,16 @@ /*globals template*/

var extend = function (objA, objB) {
'use strict';
for (var i in objB) {
if (objB.hasOwnProperty(i)) {
if (objA.hasOwnProperty(i) && typeof objA[i] === 'object') {
objA[i] = extend(objB[i]);
} else {
objA[i] = objB[i];
}
}
}
return objA;
};
var I18n = function () {

@@ -78,2 +92,6 @@ 'use strict';

this.getDefaults = function () {
return defaults;
};
this.setLang = function (lang) {

@@ -85,3 +103,3 @@ localLang = lang;

this.setDefaults = function (options) {
defaults = options || {};
defaults = extend(defaults, options || {});
};

@@ -101,4 +119,5 @@

var obj = parse(lng + '.' + key, dico);
var obj = parse(lng + '.' + key, defaults) ||
parse(key, defaults) ||
parse(lng + '.' + key, dico);
options = options || {};

@@ -105,0 +124,0 @@

@@ -114,2 +114,3 @@ describe('i18njs', function () {

expect(i18n.get('ns.inter')).to.eql('default');
expect(i18n.get('key')).to.eql('default');
});

@@ -128,4 +129,6 @@

expect(i18n.get('ns.inter')).to.eql('default_en');
expect(i18n.get('key')).to.eql('default_en');
i18n.setLang('fr');
expect(i18n.get('ns.inter')).to.eql('default_fr');
expect(i18n.get('key')).to.eql('default_fr');
});

@@ -132,0 +135,0 @@

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