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

vue-i18n

Package Overview
Dependencies
Maintainers
1
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

10

CHANGELOG.md

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

<a name="5.0.3"></a>
## [5.0.3](https://github.com/kazupon/vue-i18n/compare/v5.0.2...v5.0.3) (2017-02-27)
### :zap: Improvements
* **vue:** support vue 2.2 ([de6429b](https://github.com/kazupon/vue-i18n/commit/de6429b))
<a name="5.0.2"></a>

@@ -2,0 +12,0 @@ ## [5.0.2](https://github.com/kazupon/vue-i18n/compare/v5.0.1...v5.0.2) (2017-02-18)

101

dist/vue-i18n.common.js
/*!
* vue-i18n v5.0.2
* vue-i18n v5.0.3
* (c) 2017 kazuya kawaguchi

@@ -169,2 +169,74 @@ * Released under the MIT License.

/**
* utilites
*/
/**
* isNil
*
* @param {*} val
* @return Boolean
*/
function isNil (val) {
return val === null || val === undefined
}
/**
* Simple bind, faster than native
*
* @param {Function} fn
* @param {Object} ctx
* @return Function
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*
* @param {Object} obj
* @return Boolean
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*
* @param {Object} obj
* @return Boolean
*/
var toString = Object.prototype.toString;
var OBJECT_STRING = '[object Object]';
function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
}
/**
* Check whether the object has the property.
*
* @param {Object} obj
* @param {String} key
* @return Boolean
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
var fallback; // fallback lang

@@ -175,4 +247,2 @@ var missingHandler = null; // missing handler

var Config = function (Vue, langVM, lang) {
var ref = Vue.util;
var bind = ref.bind;
var Watcher = getWatcher(langVM);

@@ -228,16 +298,2 @@ var Dep = getDep(langVM);

/**
* utilites
*/
/**
* isNil
*
* @param {*} val
* @return Boolean
*/
function isNil (val) {
return val === null || val === undefined
}
/**
* String format template

@@ -252,5 +308,2 @@ * - Inspired:

var Format = function (Vue) {
var ref = Vue.util;
var hasOwn = ref.hasOwn;
/**

@@ -587,7 +640,2 @@ * template

var Path = function (Vue) {
var ref = Vue.util;
var isObject = ref.isObject;
var isPlainObject = ref.isPlainObject;
var hasOwn = ref.hasOwn;
function empty (target) {

@@ -653,5 +701,2 @@ if (target === null || target === undefined) { return true }

var Extend = function (Vue) {
var ref = Vue.util;
var isObject = ref.isObject;
var bind = ref.bind;
var format = Format(Vue);

@@ -658,0 +703,0 @@ var getValue = Path(Vue);

/*!
* vue-i18n v5.0.2
* vue-i18n v5.0.3
* (c) 2017 kazuya kawaguchi

@@ -173,2 +173,74 @@ * Released under the MIT License.

/**
* utilites
*/
/**
* isNil
*
* @param {*} val
* @return Boolean
*/
function isNil (val) {
return val === null || val === undefined
}
/**
* Simple bind, faster than native
*
* @param {Function} fn
* @param {Object} ctx
* @return Function
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*
* @param {Object} obj
* @return Boolean
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*
* @param {Object} obj
* @return Boolean
*/
var toString = Object.prototype.toString;
var OBJECT_STRING = '[object Object]';
function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
}
/**
* Check whether the object has the property.
*
* @param {Object} obj
* @param {String} key
* @return Boolean
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
var fallback; // fallback lang

@@ -179,4 +251,2 @@ var missingHandler = null; // missing handler

var Config = function (Vue, langVM, lang) {
var ref = Vue.util;
var bind = ref.bind;
var Watcher = getWatcher(langVM);

@@ -232,16 +302,2 @@ var Dep = getDep(langVM);

/**
* utilites
*/
/**
* isNil
*
* @param {*} val
* @return Boolean
*/
function isNil (val) {
return val === null || val === undefined
}
/**
* String format template

@@ -256,5 +312,2 @@ * - Inspired:

var Format = function (Vue) {
var ref = Vue.util;
var hasOwn = ref.hasOwn;
/**

@@ -591,7 +644,2 @@ * template

var Path = function (Vue) {
var ref = Vue.util;
var isObject = ref.isObject;
var isPlainObject = ref.isPlainObject;
var hasOwn = ref.hasOwn;
function empty (target) {

@@ -657,5 +705,2 @@ if (target === null || target === undefined) { return true }

var Extend = function (Vue) {
var ref = Vue.util;
var isObject = ref.isObject;
var bind = ref.bind;
var format = Format(Vue);

@@ -966,3 +1011,3 @@ var getValue = Path(Vue);

plugin.version = '5.0.2';
plugin.version = '5.0.3';

@@ -969,0 +1014,0 @@ if (typeof window !== 'undefined' && window.Vue) {

/*!
* vue-i18n v5.0.2
* vue-i18n v5.0.3
* (c) 2017 kazuya kawaguchi
* Released under the MIT License.
*/
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.VueI18n=t()}(this,function(){"use strict";function n(n,t){window.console&&(console.warn("[vue-i18n] "+n),t&&console.warn(t.stack))}function t(n,t,r){if("object"==typeof t)r(t);else{var i=t.call(this);if("function"==typeof i)if(i.resolved)r(i.resolved);else if(i.requested)i.pendingCallbacks.push(r);else{i.requested=!0;var o=i.pendingCallbacks=[r];i(function(n){i.resolved=n;for(var t=0,e=o.length;t<e;t++)o[t](n)},function(){r()})}else e(i)&&i.then(function(n){r(n)},function(){r()}).catch(function(n){console.error(n),r()})}}function e(n){return n&&"function"==typeof n.then}function r(n){if(!g){var t=n.$watch("__watcher__",function(n){});g=n._watchers[0].constructor,t()}return g}function i(n){return!v&&n&&n._data&&n._data.__ob__&&n._data.__ob__.dep&&(v=n._data.__ob__.dep.constructor),v}function o(n){return null===n||void 0===n}function a(n){return Z.test(n)}function u(n){var t=n.charCodeAt(0),e=n.charCodeAt(n.length-1);return t!==e||34!==t&&39!==t?n:n.slice(1,-1)}function l(n){if(void 0===n)return"eof";var t=n.charCodeAt(0);switch(t){case 91:case 93:case 46:case 34:case 39:case 48:return n;case 95:case 36:case 45:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return t>=97&&t<=122||t>=65&&t<=90?"ident":t>=49&&t<=57?"number":"else"}function c(n){var t=n.trim();return("0"!==n.charAt(0)||!isNaN(n))&&(a(t)?u(t):"*"+t)}function f(n){function t(){var t=n[d+1];if(p===N&&"'"===t||p===q&&'"'===t)return d++,r="\\"+t,v[j](),!0}var e,r,i,o,a,u,f,s=[],d=-1,p=U,g=0,v=[];for(v[k]=function(){void 0!==i&&(s.push(i),i=void 0)},v[j]=function(){void 0===i?i=r:i+=r},v[P]=function(){v[j](),g++},v[C]=function(){if(g>0)g--,p=H,v[j]();else{if(g=0,i=c(i),i===!1)return!1;v[k]()}};null!=p;)if(d++,e=n[d],"\\"!==e||!t()){if(o=l(e),f=M[p],a=f[o]||f.else||L,a===L)return;if(p=a[0],u=v[a[1]],u&&(r=a[2],r=void 0===r?e:r,u()===!1))return;if(p===z)return s.raw=n,s}}function s(n){var t=O[n];return t||(t=f(n),t&&(O[n]=t)),t}function d(n,t){void 0===t&&(t={});var e=(n.version&&Number(n.version.split(".")[0])||-1,"en");p(n,e),y(n,I),b(n,I),m(n,I,e),D(n)}function p(n,t){var e=n.config.silent;n.config.silent=!0,I||(I=new n({data:{lang:t,locales:{}}})),n.config.silent=e}var g,v,h,y=function(e,r){e.locale=function(e,i,o){return void 0===i?r.locales[e]:void(null===i?(r.locales[e]=void 0,delete r.locales[e]):t(e,i,function(t){t?r.$set(r.locales,e,t):n("failed set `"+e+"` locale"),o&&o()}))}},b=function(n,t){var e=n.prototype._init;n.prototype._init=function(n){var r=this;e.call(this,n),this.$parent||(this._$lang=t,this._langUnwatch=this._$lang.$watch("$data",function(n,t){r.$forceUpdate()},{deep:!0}))};var r=n.prototype._destroy;n.prototype._destroy=function(){!this.$parent&&this._langUnwatch&&(this._langUnwatch(),this._langUnwatch=null,this._$lang=null),r.apply(this,arguments)}},_=null,w=null,m=function(n,t,e){function o(n,t){var e=new l(t,n,null,{lazy:!0});return function(){return e.dirty&&e.evaluate(),c&&c.target&&e.depend(),e.value}}var a=n.util,u=a.bind,l=r(t),c=i(t);Object.defineProperty(n.config,"lang",{enumerable:!0,configurable:!0,get:o(function(){return t.lang},t),set:u(function(n){t.lang=n},t)}),h=e,Object.defineProperty(n.config,"fallbackLang",{enumerable:!0,configurable:!0,get:function(){return h},set:function(n){h=n}}),Object.defineProperty(n.config,"missingHandler",{enumerable:!0,configurable:!0,get:function(){return _},set:function(n){_=n}}),Object.defineProperty(n.config,"i18nFormatter",{enumerable:!0,configurable:!0,get:function(){return w},set:function(n){w=n}})},$=/(%|)\{([0-9a-zA-Z_]+)\}/g,A=function(n){function t(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return t=1===t.length&&"object"==typeof t[0]?t[0]:{},t&&t.hasOwnProperty||(t={}),n.replace($,function(e,i,a,u){var l;return"{"===n[u-1]&&"}"===n[u+e.length]?a:(l=r(t,a)?t[a]:e,o(l)?"":l)})}var e=n.util,r=e.hasOwn;return t},O=Object.create(null),j=0,k=1,P=2,C=3,U=0,x=1,V=2,F=3,H=4,N=5,q=6,z=7,L=8,M=[];M[U]={ws:[U],ident:[F,j],"[":[H],eof:[z]},M[x]={ws:[x],".":[V],"[":[H],eof:[z]},M[V]={ws:[V],ident:[F,j],0:[F,j],number:[F,j]},M[F]={ident:[F,j],0:[F,j],number:[F,j],ws:[x,k],".":[V,k],"[":[H,k],eof:[z,k]},M[H]={"'":[N,j],'"':[q,j],"[":[H,P],"]":[x,C],eof:L,else:[H,j]},M[N]={"'":[H,j],eof:L,else:[N,j]},M[q]={'"':[H,j],eof:L,else:[q,j]};var I,Z=/^\s?(true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/,B=function(n){function t(n){if(null===n||void 0===n)return!0;if(Array.isArray(n)){if(n.length>0)return!1;if(0===n.length)return!0}else if(o(n))for(var t in n)if(a(n,t))return!1;return!0}function e(n,e){if(!i(n))return null;var r=s(e);if(t(r))return null;for(var o=r.length,a=null,u=n,l=0;l<o;){var c=u[r[l]];if(void 0===c){u=null;break}u=c,l++}return a=u}var r=n.util,i=r.isObject,o=r.isPlainObject,a=r.hasOwn;return e},D=function(t){function e(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var r=t.config.lang,i=t.config.fallbackLang;return 1===n.length?g(n[0])||Array.isArray(n[0])?n=n[0]:"string"==typeof n[0]&&(r=n[0]):2===n.length&&("string"==typeof n[0]&&(r=n[0]),(g(n[1])||Array.isArray(n[1]))&&(n=n[1])),{lang:r,fallback:i,params:n}}function r(n,t){return!(!n||!t)&&!o(y(n,t))}function i(e,r,a){if(!e)return null;var u=y(e,r);if(Array.isArray(u))return u;if(o(u)&&(u=e[r]),o(u))return null;if("string"!=typeof u)return n("Value of key '"+r+"' is not a string!"),null;if(u.indexOf("@:")>=0){var l=u.match(/(@:[\w|.]+)/g);for(var c in l){var f=l[c],s=f.substr(2),d=i(e,s,a);u=u.replace(f,d)}}return a?t.config.i18nFormatter?t.config.i18nFormatter.apply(null,[u].concat(a)):h(u,a):u}function a(n,t,e,r,a){var u=null;return u=i(n(t),r,a),o(u)?(u=i(n(e),r,a),o(u)?null:u):u}function u(n,e,r,i){return o(i)?(t.config.missingHandler&&t.config.missingHandler.apply(null,[n,e,r]),e):i}function l(n){return t.locale(n)}function c(n){return this.$options.locales[n]}function f(n){return n?n>1?1:0:1}function s(n,t){return n=Math.abs(n),2===t?f(n):n?Math.min(n,2):0}function d(n,t){if(!n&&"string"!=typeof n)return null;var e=n.split("|");return t=s(t,e.length),e[t]?e[t].trim():n}var p=t.util,g=p.isObject,v=p.bind,h=A(t),y=B(t);return t.t=function(n){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!n)return"";var i=e.apply(void 0,t),o=i.lang,c=i.fallback,f=i.params;return u(o,n,null,a(l,o,c,n,f))},t.tc=function(n,e){for(var r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];return d(t.t.apply(t,[n].concat(r)),e)},t.te=function(n){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var o=e.apply(void 0,t),a=o.lang;return r(l(a),n)},t.prototype.$t=function(n){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!n)return"";var i=e.apply(void 0,t),o=i.lang,f=i.fallback,s=i.params,d=null;return this.$options.locales&&(d=a(v(c,this),o,f,n,s))?d:u(o,n,this,a(l,o,f,n,s))},t.prototype.$tc=function(n,t){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return"number"!=typeof t&&"undefined"!=typeof t?n:d((i=this).$t.apply(i,[n].concat(e)),t);var i},t.prototype.$te=function(n){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var o=e.apply(void 0,t),a=o.lang,u=!1;return this.$options.locales&&(u=r(v(c)(a),n)),u||(u=r(l(a),n)),u},t.mixin({computed:{$lang:function(){return t.config.lang}}}),t};return d.version="5.0.2","undefined"!=typeof window&&window.Vue&&window.Vue.use(d),d});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.VueI18n=t()}(this,function(){"use strict";function n(n,t){window.console&&(console.warn("[vue-i18n] "+n),t&&console.warn(t.stack))}function t(n,t,r){if("object"==typeof t)r(t);else{var o=t.call(this);if("function"==typeof o)if(o.resolved)r(o.resolved);else if(o.requested)o.pendingCallbacks.push(r);else{o.requested=!0;var i=o.pendingCallbacks=[r];o(function(n){o.resolved=n;for(var t=0,e=i.length;t<e;t++)i[t](n)},function(){r()})}else e(o)&&o.then(function(n){r(n)},function(){r()}).catch(function(n){console.error(n),r()})}}function e(n){return n&&"function"==typeof n.then}function r(n){if(!b){var t=n.$watch("__watcher__",function(n){});b=n._watchers[0].constructor,t()}return b}function o(n){return!_&&n&&n._data&&n._data.__ob__&&n._data.__ob__.dep&&(_=n._data.__ob__.dep.constructor),_}function i(n){return null===n||void 0===n}function a(n,t){function e(e){var r=arguments.length;return r?r>1?n.apply(t,arguments):n.call(t,e):n.call(t)}return e._length=n.length,e}function u(n){return null!==n&&"object"==typeof n}function l(n){return j.call(n)===A}function c(n,t){return O.call(n,t)}function f(n){return K.test(n)}function s(n){var t=n.charCodeAt(0),e=n.charCodeAt(n.length-1);return t!==e||34!==t&&39!==t?n:n.slice(1,-1)}function p(n){if(void 0===n)return"eof";var t=n.charCodeAt(0);switch(t){case 91:case 93:case 46:case 34:case 39:case 48:return n;case 95:case 36:case 45:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return t>=97&&t<=122||t>=65&&t<=90?"ident":t>=49&&t<=57?"number":"else"}function g(n){var t=n.trim();return("0"!==n.charAt(0)||!isNaN(n))&&(f(t)?s(t):"*"+t)}function d(n){function t(){var t=n[f+1];if(s===Z&&"'"===t||s===B&&'"'===t)return f++,r="\\"+t,v[F](),!0}var e,r,o,i,a,u,l,c=[],f=-1,s=z,d=0,v=[];for(v[H]=function(){void 0!==o&&(c.push(o),o=void 0)},v[F]=function(){void 0===o?o=r:o+=r},v[N]=function(){v[F](),d++},v[q]=function(){if(d>0)d--,s=S,v[F]();else{if(d=0,o=g(o),o===!1)return!1;v[H]()}};null!=s;)if(f++,e=n[f],"\\"!==e||!t()){if(i=p(e),l=G[s],a=l[i]||l.else||E,a===E)return;if(s=a[0],u=v[a[1]],u&&(r=a[2],r=void 0===r?e:r,u()===!1))return;if(s===D)return c.raw=n,c}}function v(n){var t=V[n];return t||(t=d(n),t&&(V[n]=t)),t}function h(n,t){void 0===t&&(t={});var e=(n.version&&Number(n.version.split(".")[0])||-1,"en");y(n,e),m(n,J),$(n,J),C(n,J,e),R(n)}function y(n,t){var e=n.config.silent;n.config.silent=!0,J||(J=new n({data:{lang:t,locales:{}}})),n.config.silent=e}var b,_,w,m=function(e,r){e.locale=function(e,o,i){return void 0===o?r.locales[e]:void(null===o?(r.locales[e]=void 0,delete r.locales[e]):t(e,o,function(t){t?r.$set(r.locales,e,t):n("failed set `"+e+"` locale"),i&&i()}))}},$=function(n,t){var e=n.prototype._init;n.prototype._init=function(n){var r=this;e.call(this,n),this.$parent||(this._$lang=t,this._langUnwatch=this._$lang.$watch("$data",function(n,t){r.$forceUpdate()},{deep:!0}))};var r=n.prototype._destroy;n.prototype._destroy=function(){!this.$parent&&this._langUnwatch&&(this._langUnwatch(),this._langUnwatch=null,this._$lang=null),r.apply(this,arguments)}},j=Object.prototype.toString,A="[object Object]",O=Object.prototype.hasOwnProperty,k=null,P=null,C=function(n,t,e){function i(n,t){var e=new u(t,n,null,{lazy:!0});return function(){return e.dirty&&e.evaluate(),l&&l.target&&e.depend(),e.value}}var u=r(t),l=o(t);Object.defineProperty(n.config,"lang",{enumerable:!0,configurable:!0,get:i(function(){return t.lang},t),set:a(function(n){t.lang=n},t)}),w=e,Object.defineProperty(n.config,"fallbackLang",{enumerable:!0,configurable:!0,get:function(){return w},set:function(n){w=n}}),Object.defineProperty(n.config,"missingHandler",{enumerable:!0,configurable:!0,get:function(){return k},set:function(n){k=n}}),Object.defineProperty(n.config,"i18nFormatter",{enumerable:!0,configurable:!0,get:function(){return P},set:function(n){P=n}})},U=/(%|)\{([0-9a-zA-Z_]+)\}/g,x=function(n){function t(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return t=1===t.length&&"object"==typeof t[0]?t[0]:{},t&&t.hasOwnProperty||(t={}),n.replace(U,function(e,r,o,a){var u;return"{"===n[a-1]&&"}"===n[a+e.length]?o:(u=c(t,o)?t[o]:e,i(u)?"":u)})}return t},V=Object.create(null),F=0,H=1,N=2,q=3,z=0,L=1,M=2,I=3,S=4,Z=5,B=6,D=7,E=8,G=[];G[z]={ws:[z],ident:[I,F],"[":[S],eof:[D]},G[L]={ws:[L],".":[M],"[":[S],eof:[D]},G[M]={ws:[M],ident:[I,F],0:[I,F],number:[I,F]},G[I]={ident:[I,F],0:[I,F],number:[I,F],ws:[L,H],".":[M,H],"[":[S,H],eof:[D,H]},G[S]={"'":[Z,F],'"':[B,F],"[":[S,N],"]":[L,q],eof:E,else:[S,F]},G[Z]={"'":[S,F],eof:E,else:[Z,F]},G[B]={'"':[S,F],eof:E,else:[B,F]};var J,K=/^\s?(true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/,Q=function(n){function t(n){if(null===n||void 0===n)return!0;if(Array.isArray(n)){if(n.length>0)return!1;if(0===n.length)return!0}else if(l(n))for(var t in n)if(c(n,t))return!1;return!0}function e(n,e){if(!u(n))return null;var r=v(e);if(t(r))return null;for(var o=r.length,i=null,a=n,l=0;l<o;){var c=a[r[l]];if(void 0===c){a=null;break}a=c,l++}return i=a}return e},R=function(t){function e(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var r=t.config.lang,o=t.config.fallbackLang;return 1===n.length?u(n[0])||Array.isArray(n[0])?n=n[0]:"string"==typeof n[0]&&(r=n[0]):2===n.length&&("string"==typeof n[0]&&(r=n[0]),(u(n[1])||Array.isArray(n[1]))&&(n=n[1])),{lang:r,fallback:o,params:n}}function r(n,t){return!(!n||!t)&&!i(h(n,t))}function o(e,r,a){if(!e)return null;var u=h(e,r);if(Array.isArray(u))return u;if(i(u)&&(u=e[r]),i(u))return null;if("string"!=typeof u)return n("Value of key '"+r+"' is not a string!"),null;if(u.indexOf("@:")>=0){var l=u.match(/(@:[\w|.]+)/g);for(var c in l){var f=l[c],s=f.substr(2),p=o(e,s,a);u=u.replace(f,p)}}return a?t.config.i18nFormatter?t.config.i18nFormatter.apply(null,[u].concat(a)):v(u,a):u}function l(n,t,e,r,a){var u=null;return u=o(n(t),r,a),i(u)?(u=o(n(e),r,a),i(u)?null:u):u}function c(n,e,r,o){return i(o)?(t.config.missingHandler&&t.config.missingHandler.apply(null,[n,e,r]),e):o}function f(n){return t.locale(n)}function s(n){return this.$options.locales[n]}function p(n){return n?n>1?1:0:1}function g(n,t){return n=Math.abs(n),2===t?p(n):n?Math.min(n,2):0}function d(n,t){if(!n&&"string"!=typeof n)return null;var e=n.split("|");return t=g(t,e.length),e[t]?e[t].trim():n}var v=x(t),h=Q(t);return t.t=function(n){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!n)return"";var o=e.apply(void 0,t),i=o.lang,a=o.fallback,u=o.params;return c(i,n,null,l(f,i,a,n,u))},t.tc=function(n,e){for(var r=[],o=arguments.length-2;o-- >0;)r[o]=arguments[o+2];return d(t.t.apply(t,[n].concat(r)),e)},t.te=function(n){for(var t=[],o=arguments.length-1;o-- >0;)t[o]=arguments[o+1];var i=e.apply(void 0,t),a=i.lang;return r(f(a),n)},t.prototype.$t=function(n){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if(!n)return"";var o=e.apply(void 0,t),i=o.lang,u=o.fallback,p=o.params,g=null;return this.$options.locales&&(g=l(a(s,this),i,u,n,p))?g:c(i,n,this,l(f,i,u,n,p))},t.prototype.$tc=function(n,t){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return"number"!=typeof t&&"undefined"!=typeof t?n:d((o=this).$t.apply(o,[n].concat(e)),t);var o},t.prototype.$te=function(n){for(var t=[],o=arguments.length-1;o-- >0;)t[o]=arguments[o+1];var i=e.apply(void 0,t),u=i.lang,l=!1;return this.$options.locales&&(l=r(a(s)(u),n)),l||(l=r(f(u),n)),l},t.mixin({computed:{$lang:function(){return t.config.lang}}}),t};return h.version="5.0.3","undefined"!=typeof window&&window.Vue&&window.Vue.use(h),h});
{
"name": "vue-i18n",
"description": "Internationalization plugin for Vue.js",
"version": "5.0.2",
"version": "5.0.3",
"author": {

@@ -101,3 +101,3 @@ "name": "kazuya kawaguchi",

"sauce:mobile": "karma start config/karma.sauce.conf.js -- 2",
"test": "npm run lint && npm run flow && npm run test:cover && npm run test:e2e -- --env phantomjs",
"test": "npm run lint && npm run test:cover && npm run test:e2e -- --env phantomjs",
"test:cover": "BABEL_ENV=test karma start config/karma.cover.conf.js",

@@ -104,0 +104,0 @@ "test:e2e": "npm run build && node test/e2e/runner.js",

import { getWatcher, getDep } from './observer'
import { bind } from './util'

@@ -8,3 +9,2 @@ let fallback // fallback lang

export default function (Vue, langVM, lang) {
const { bind } = Vue.util
const Watcher = getWatcher(langVM)

@@ -11,0 +11,0 @@ const Dep = getDep(langVM)

import warn from './warn'
import Format from './format'
import Path from './path'
import { isNil } from './util'
import { isNil, isObject, bind } from './util'

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

export default function (Vue) {
const { isObject, bind } = Vue.util
const format = Format(Vue)

@@ -17,0 +16,0 @@ const getValue = Path(Vue)

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

import { isNil } from './util'
import { isNil, hasOwn } from './util'

@@ -13,4 +13,2 @@ /**

export default function (Vue) {
const { hasOwn } = Vue.util
/**

@@ -17,0 +15,0 @@ * template

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

import { isObject, isPlainObject, hasOwn } from './util'
/**

@@ -290,4 +292,2 @@ * Path paerser

export default function (Vue) {
const { isObject, isPlainObject, hasOwn } = Vue.util
function empty (target) {

@@ -294,0 +294,0 @@ if (target === null || target === undefined) { return true }

@@ -14,1 +14,59 @@ /**

}
/**
* Simple bind, faster than native
*
* @param {Function} fn
* @param {Object} ctx
* @return Function
*/
export function bind (fn, ctx) {
function boundFn (a) {
const l = arguments.length
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length
return boundFn
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*
* @param {Object} obj
* @return Boolean
*/
export function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*
* @param {Object} obj
* @return Boolean
*/
const toString = Object.prototype.toString
const OBJECT_STRING = '[object Object]'
export function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
}
/**
* Check whether the object has the property.
*
* @param {Object} obj
* @param {String} key
* @return Boolean
*/
const hasOwnProperty = Object.prototype.hasOwnProperty
export function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
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