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 2.3.1 to 2.3.2

dist/vue-i18n.common.js

10

CHANGELOG.md

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

<a name="2.3.2"></a>
## [2.3.2](https://github.com/kazupon/vue-i18n/compare/v2.3.1...v2.3.2) (2015-12-09)
### Features
* **bundle:** more compact the vue-i18n distribution file ([2f32ecc](https://github.com/kazupon/vue-i18n/commit/2f32ecc))
<a name="2.3.1"></a>

@@ -2,0 +12,0 @@ ## [2.3.1](https://github.com/kazupon/vue-i18n/compare/v2.3.0...v2.3.1) (2015-12-01)

465

dist/vue-i18n.js
/*!
* vue-i18n v2.3.1
* vue-i18n v2.3.2
* (c) 2015 kazuya kawaguchi
* Released under the MIT License.
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["vue-i18n"] = factory();
else
root["vue-i18n"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.VueI18n = factory();
}(this, function () { 'use strict';
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
var babelHelpers = {};
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
babelHelpers.typeof = function (obj) {
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
babelHelpers;
/**
* String format template
* - Inspired:
* https://github.com/Matt-Esch/string-template/index.js
*/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
var RE_NARGS = /\{([0-9a-zA-Z]+)\}/g;
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/**
* template
*
* @param {String} string
* @param {Array} ...args
* @return {String}
*/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
function format (string) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (args.length === 1 && babelHelpers.typeof(args[0]) === 'object') {
args = args[0];
}
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
if (!args || !args.hasOwnProperty) {
args = {};
}
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
return string.replace(RE_NARGS, function (match, i, index) {
var result = undefined;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
if (string[index - 1] === '{' && string[index + match.length] === '}') {
return i;
} else {
result = args.hasOwnProperty(i) ? args[i] : null;
if (result === null || result === undefined) {
return '';
}
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
return result;
}
});
}
'use strict';
/**
* Version compare
* - Inspired:
* https://github.com/omichelsen/compare-versions
*/
Object.defineProperty(exports, '__esModule', {
value: true
});
var PATCH_PATTERN = /-([\w-.]+)/;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function split(v) {
var temp = v.split('.');
var arr = temp.splice(0, 2);
arr.push(temp.join('.'));
return arr;
}
var _extend = __webpack_require__(1);
/**
* compare
*
* @param {String} v1
* @param {String} v2
* @return {Number}
*/
var _extend2 = _interopRequireDefault(_extend);
function compare (v1, v2) {
var s1 = split(v1);
var s2 = split(v2);
/**
* plugin
*
* @param {Object} Vue
* @param {Object} opts
*/
for (var i = 0; i < 3; i++) {
var n1 = parseInt(s1[i] || 0, 10);
var n2 = parseInt(s2[i] || 0, 10);
exports['default'] = function (Vue) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? { lang: 'en', locales: {} } : arguments[1];
if (n1 > n2) {
return 1;
}
if (n2 > n1) {
return -1;
}
}
defineConfig(Vue.config, opts.lang);
(0, _extend2['default'])(Vue, opts.locales);
};
if ((s1[2] + s2[2] + '').indexOf('-') > -1) {
var p1 = (PATCH_PATTERN.exec(s1[2]) || [''])[0];
var p2 = (PATCH_PATTERN.exec(s2[2]) || [''])[0];
/**
* defineConfig
*
* This function define `lang` property to `Vue.config`.
*
* @param {Object} config
* @param {String} lang
* @private
*/
if (p1 === '') {
return 1;
}
if (p2 === '') {
return -1;
}
if (p1 > p2) {
return 1;
}
if (p2 > p1) {
return -1;
}
}
function defineConfig(config, lang) {
Object.defineProperty(config, 'lang', {
get: function get() {
return lang;
},
set: function set(val) {
lang = val;
}
});
}
module.exports = exports['default'];
return 0;
}
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/**
* extend
*
* @param {Vue} Vue
* @param {Object} locales
* @return {Vue}
*/
'use strict';
function extend (Vue, locales) {
var getPath = Vue.version && compare('1.0.8', Vue.version) === -1 ? Vue.parsers.path.getPath : Vue.parsers.path.get;
var util = Vue.util;
Object.defineProperty(exports, '__esModule', {
value: true
});
function getVal(key, lang, args) {
var value = key;
try {
var val = getPath(locales[lang], key) || locales[lang][key];
value = (args ? format(val, args) : val) || key;
} catch (e) {
value = key;
}
return value;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* $t
*
* @param {String} key
* @param {Array} ...args
* @return {String}
*/
var _format = __webpack_require__(2);
Vue.prototype.$t = function (key) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var _format2 = _interopRequireDefault(_format);
if (!key) {
return '';
}
var _compare = __webpack_require__(3);
var language = Vue.config.lang;
if (args.length === 1) {
if (util.isObject(args[0]) || util.isArray(args[0])) {
args = args[0];
} else if (typeof args[0] === 'string') {
language = args[0];
}
} else if (args.length === 2) {
if (typeof args[0] === 'string') {
language = args[0];
}
if (util.isObject(args[1]) || util.isArray(args[1])) {
args = args[1];
}
}
var _compare2 = _interopRequireDefault(_compare);
return getVal(key, language, args);
};
/**
* extend
*
* @param {Vue} Vue
* @param {Object} locales
* @return {Vue}
*/
return Vue;
}
exports['default'] = function (Vue, locales) {
var getPath = Vue.version && (0, _compare2['default'])('1.0.8', Vue.version) === -1 ? Vue.parsers.path.getPath : Vue.parsers.path.get;
var util = Vue.util;
/**
* plugin
*
* @param {Object} Vue
* @param {Object} opts
*/
function getVal(key, lang, args) {
var value = key;
try {
var val = getPath(locales[lang], key) || locales[lang][key];
value = (args ? (0, _format2['default'])(val, args) : val) || key;
} catch (e) {
value = key;
}
return value;
}
function plugin(Vue) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? { lang: 'en', locales: {} } : arguments[1];
/**
* $t
*
* @param {String} key
* @param {Array} ...args
* @return {String}
*/
defineConfig(Vue.config, opts.lang);
extend(Vue, opts.locales);
}
Vue.prototype.$t = function (key) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
/**
* defineConfig
*
* This function define `lang` property to `Vue.config`.
*
* @param {Object} config
* @param {String} lang
* @private
*/
if (!key) {
return '';
}
function defineConfig(config, lang) {
Object.defineProperty(config, 'lang', {
get: function get() {
return lang;
},
set: function set(val) {
lang = val;
}
});
}
var language = Vue.config.lang;
if (args.length === 1) {
if (util.isObject(args[0]) || util.isArray(args[0])) {
args = args[0];
} else if (typeof args[0] === 'string') {
language = args[0];
}
} else if (args.length === 2) {
if (typeof args[0] === 'string') {
language = args[0];
}
if (util.isObject(args[1]) || util.isArray(args[1])) {
args = args[1];
}
}
plugin.version = '2.3.2';
return getVal(key, language, args);
};
return plugin;
return Vue;
};
module.exports = exports['default'];
/***/ },
/* 2 */
/***/ function(module, exports) {
/**
* String format template
* - Inspired:
* https://github.com/Matt-Esch/string-template/index.js
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var RE_NARGS = /\{([0-9a-zA-Z]+)\}/g;
/**
* template
*
* @param {String} string
* @param {Array} ...args
* @return {String}
*/
exports['default'] = function (string) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (args.length === 1 && typeof args[0] === 'object') {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return string.replace(RE_NARGS, function (match, i, index) {
var result = undefined;
if (string[index - 1] === '{' && string[index + match.length] === '}') {
return i;
} else {
result = args.hasOwnProperty(i) ? args[i] : null;
if (result === null || result === undefined) {
return '';
}
return result;
}
});
};
module.exports = exports['default'];
/***/ },
/* 3 */
/***/ function(module, exports) {
/**
* Version compare
* - Inspired:
* https://github.com/omichelsen/compare-versions
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var PATCH_PATTERN = /-([\w-.]+)/;
function split(v) {
var temp = v.split('.');
var arr = temp.splice(0, 2);
arr.push(temp.join('.'));
return arr;
}
/**
* compare
*
* @param {String} v1
* @param {String} v2
* @return {Number}
*/
exports['default'] = function (v1, v2) {
var s1 = split(v1);
var s2 = split(v2);
for (var i = 0; i < 3; i++) {
var n1 = parseInt(s1[i] || 0, 10);
var n2 = parseInt(s2[i] || 0, 10);
if (n1 > n2) {
return 1;
}
if (n2 > n1) {
return -1;
}
}
if ((s1[2] + s2[2] + '').indexOf('-') > -1) {
var p1 = (PATCH_PATTERN.exec(s1[2]) || [''])[0];
var p2 = (PATCH_PATTERN.exec(s2[2]) || [''])[0];
if (p1 === '') {
return 1;
}
if (p2 === '') {
return -1;
}
if (p1 > p2) {
return 1;
}
if (p2 > p1) {
return -1;
}
}
return 0;
};
module.exports = exports['default'];
/***/ }
/******/ ])
});
;
}));
/*!
* vue-i18n v2.3.1
* vue-i18n v2.3.2
* (c) 2015 kazuya kawaguchi
* Released under the MIT License.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["vue-i18n"]=t():e["vue-i18n"]=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){Object.defineProperty(e,"lang",{get:function(){return t},set:function(e){t=e}})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),a=n(o);t["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{lang:"en",locales:{}}:arguments[1];u(e.config,t.lang),(0,a["default"])(e,t.locales)},e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(2),o=n(u),a=r(3),f=n(a);t["default"]=function(e,t){function r(e,r,u){var a=e;try{var f=n(t[r],e)||t[r][e];a=(u?(0,o["default"])(f,u):f)||e}catch(i){a=e}return a}var n=e.version&&-1===(0,f["default"])("1.0.8",e.version)?e.parsers.path.getPath:e.parsers.path.get,u=e.util;return e.prototype.$t=function(t){for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];if(!t)return"";var f=e.config.lang;return 1===o.length?u.isObject(o[0])||u.isArray(o[0])?o=o[0]:"string"==typeof o[0]&&(f=o[0]):2===o.length&&("string"==typeof o[0]&&(f=o[0]),(u.isObject(o[1])||u.isArray(o[1]))&&(o=o[1])),r(t,f,o)},e},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=/\{([0-9a-zA-Z]+)\}/g;t["default"]=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),u=1;t>u;u++)n[u-1]=arguments[u];return 1===n.length&&"object"==typeof n[0]&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(r,function(t,r,u){var o=void 0;return"{"===e[u-1]&&"}"===e[u+t.length]?r:(o=n.hasOwnProperty(r)?n[r]:null,null===o||void 0===o?"":o)})},e.exports=t["default"]},function(e,t){"use strict";function r(e){var t=e.split("."),r=t.splice(0,2);return r.push(t.join(".")),r}Object.defineProperty(t,"__esModule",{value:!0});var n=/-([\w-.]+)/;t["default"]=function(e,t){for(var u=r(e),o=r(t),a=0;3>a;a++){var f=parseInt(u[a]||0,10),i=parseInt(o[a]||0,10);if(f>i)return 1;if(i>f)return-1}if((u[2]+o[2]+"").indexOf("-")>-1){var s=(n.exec(u[2])||[""])[0],l=(n.exec(o[2])||[""])[0];if(""===s)return 1;if(""===l)return-1;if(s>l)return 1;if(l>s)return-1}return 0},e.exports=t["default"]}])});
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):n.VueI18n=r()}(this,function(){"use strict";function n(n){for(var r=arguments.length,e=Array(r>1?r-1:0),t=1;r>t;t++)e[t-1]=arguments[t];return 1===e.length&&"object"===u["typeof"](e[0])&&(e=e[0]),e&&e.hasOwnProperty||(e={}),n.replace(a,function(r,t,o){var i=void 0;return"{"===n[o-1]&&"}"===n[o+r.length]?t:(i=e.hasOwnProperty(t)?e[t]:null,null===i||void 0===i?"":i)})}function r(n){var r=n.split("."),e=r.splice(0,2);return e.push(r.join(".")),e}function e(n,e){for(var t=r(n),o=r(e),i=0;3>i;i++){var u=parseInt(t[i]||0,10),a=parseInt(o[i]||0,10);if(u>a)return 1;if(a>u)return-1}if((t[2]+o[2]+"").indexOf("-")>-1){var s=(f.exec(t[2])||[""])[0],c=(f.exec(o[2])||[""])[0];if(""===s)return 1;if(""===c)return-1;if(s>c)return 1;if(c>s)return-1}return 0}function t(r,t){function o(r,e,o){var u=r;try{var a=i(t[e],r)||t[e][r];u=(o?n(a,o):a)||r}catch(f){u=r}return u}var i=r.version&&-1===e("1.0.8",r.version)?r.parsers.path.getPath:r.parsers.path.get,u=r.util;return r.prototype.$t=function(n){for(var e=arguments.length,t=Array(e>1?e-1:0),i=1;e>i;i++)t[i-1]=arguments[i];if(!n)return"";var a=r.config.lang;return 1===t.length?u.isObject(t[0])||u.isArray(t[0])?t=t[0]:"string"==typeof t[0]&&(a=t[0]):2===t.length&&("string"==typeof t[0]&&(a=t[0]),(u.isObject(t[1])||u.isArray(t[1]))&&(t=t[1])),o(n,a,t)},r}function o(n){var r=arguments.length<=1||void 0===arguments[1]?{lang:"en",locales:{}}:arguments[1];i(n.config,r.lang),t(n,r.locales)}function i(n,r){Object.defineProperty(n,"lang",{get:function(){return r},set:function(n){r=n}})}var u={};u["typeof"]=function(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n};var a=/\{([0-9a-zA-Z]+)\}/g,f=/-([\w-.]+)/;return o.version="2.3.2",o});
{
"name": "vue-i18n",
"description": "Internationalization plugin for Vue.js",
"version": "2.3.1",
"version": "2.3.2",
"author": {

@@ -12,12 +12,20 @@ "name": "kazuya kawaguchi",

},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.23",
"babel-loader": "^5.3.2",
"babel-plugin-espower": "^1.0.0",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-plugin-espower": "^2.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.3.13",
"babel-preset-es2015": "^6.1.18",
"babel-preset-es2015-rollup": "^1.0.0",
"cz-conventional-changelog": "^1.1.4",
"eslint": "^1.3.1",
"espower-babel": "^3.3.0",
"eslint": "^1.10.2",
"eslint-loader": "^1.1.1",
"espower-babel": "^4.0.0",
"istanbul-instrumenter-loader": "^0.1.3",
"json-loader": "^0.5.2",
"json-loader": "^0.5.4",
"karma": "^0.13.9",

@@ -35,11 +43,23 @@ "karma-chrome-launcher": "^0.2.0",

"karma-webpack": "^1.7.0",
"mocha": "^2.3.1",
"mocha": "^2.3.4",
"mocha-loader": "^0.7.1",
"nightmare": "^2.0.8",
"phantomjs": "^1.9.19",
"power-assert": "^1.0.0",
"power-assert": "^1.2.0",
"rollup": "^0.21.1",
"rollup-plugin-babel": "^2.2.0",
"rollup-plugin-replace": "^1.1.0",
"uglify-js": "^2.6.1",
"vue": "^0.12.0",
"webpack": "^1.12.1",
"webpack-dev-server": "^1.11.0"
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"files": [
"dist/vue-i18n.js",
"dist/vue-i18n.min.js",
"dist/vue-i18n.common.js",
"src"
],
"homepage": "https://github.com/kazupon/vue-i18n",
"jsnext:main": "src/index.js",
"keywords": [

@@ -53,31 +73,24 @@ "i18n",

"license": "MIT",
"main": "dist/vue-i18n.js",
"main": "dist/vue-i18n.common.js",
"repository": {
"type": "git",
"url": "git://github.com/kazupon/vue-i18n.git"
"url": "git+https://github.com/kazupon/vue-i18n.git"
},
"scripts": {
"browser": "VUE_I18N_TYPE=browser karma start config/karma.conf.js",
"build": "babel src --out-dir lib --source-maps-inline",
"bundle": "webpack --config config/webpack.conf.js && webpack --config config/webpack.min.conf.js",
"build": "node config/build.js",
"ci": "npm run lint && npm run coverage && npm run coveralls && npm run sauce",
"clean": "rm -rf lib && rm -rf coverage && rm -rf dist",
"clean": "rm -rf coverage && rm -rf dist/*.*",
"coolkids": "VUE_I18N_TYPE=sauce SAUCE=batch1 karma start config/karma.conf.js",
"coverage": "VUE_I18N_TYPE=coverage karma start config/karma.conf.js",
"coveralls": "VUE_I18N_TYPE=coveralls karma start config/karma.conf.js",
"dist": "npm run build && npm run bundle",
"e2e": "webpack-dev-server --quiet -h --config config/webpack.e2e.conf.js --content-base test/e2e & mocha -t 20000 --compilers js:espower-babel/guess test/e2e/test.js && kill $! || (kill $! && exit 1)",
"dev": "webpack-dev-server --quiet --config config/webpack.test.conf.js",
"e2e": "webpack-dev-server --quiet --config config/webpack.e2e.conf.js & mocha -t 20000 --compilers js:espower-babel/guess test/e2e/test.js && kill $! || (kill $! && exit 1)",
"ie": "VUE_I18N_TYPE=sauce SAUCE=batch2 karma start config/karma.conf.js",
"lint": "eslint src test",
"lint": "eslint src test config",
"mobile": "VUE_I18N_TYPE=sauce SAUCE=batch3 karma start config/karma.conf.js",
"sauce": "npm run coolkids && npm run ie && npm run mobile",
"test": "npm run ci",
"unit": "npm run lint && karma start config/karma.conf.js",
"watch": "babel src --out-dir lib --watch --source-maps-inline"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
"unit": "npm run lint && karma start config/karma.conf.js"
}
}

@@ -25,8 +25,2 @@ # vue-i18n

## bower
```shell
$ bower install vue-i18n
```
When used in CommonJS, you must explicitly install the router via Vue.use():

@@ -36,5 +30,5 @@

var Vue = require('vue')
var i18n = require('vue-validator')
var VueI18n = require('vue-i18n')
Vue.use(i18n, { ... })
Vue.use(VueI18n, { ... })
```

@@ -41,0 +35,0 @@

@@ -11,3 +11,3 @@ import extend from './extend'

export default function (Vue, opts = { lang: 'en', locales: {} }) {
function plugin (Vue, opts = { lang: 'en', locales: {} }) {
defineConfig(Vue.config, opts.lang)

@@ -34,1 +34,5 @@ extend(Vue, opts.locales)

}
plugin.version = '2.3.2'
export default plugin
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