Socket
Socket
Sign inDemoInstall

svelte-i18n

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-i18n - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

dist/i18n.js

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

function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("deepmerge")),n=e(require("object-resolve-path")),r=function(e){return e.replace(/(^|\s)\S/,function(e){return e.toUpperCase()})},o=function(e){return e.replace(/(^|\s)\S/g,function(e){return e.toUpperCase()})},a=function(e){return e.toLocaleUpperCase()},u=function(e){return e.toLocaleLowerCase()},i=function(e){return null!==e&&"object"==typeof e},c=/^(\d)+/,l=/^(\w)+/,s=function(){this._caches=Object.create(null)};s.prototype.interpolate=function(e,t){if(!t)return[e];var n=this._caches[e];return n||(n=function(e){var t=[],n=0,r="";for(;n<e.length;){var o=e[n++];if("{"!==o||n>0&&"\\"===o[n-1])r+=o;else{r.length&&t.push({type:"text",value:r}),r="";var a="";for(o=e[n++];"}"!==o;)a+=o,o=e[n++];var u=c.test(a)?"list":l.test(a)?"named":"unknown";t.push({value:a,type:u})}}r&&t.push({type:"text",value:r});return t}(e),this._caches[e]=n),function(e,t){var n=[],r=0,o=Array.isArray(t)?"list":i(t)?"named":"unknown";if("unknown"===o)return n;for(;r<e.length;){var a=e[r++];switch(a.type){case"text":n.push(a.value);break;case"list":n.push(t[parseInt(a.value,10)]);break;case"named":"named"===o?n.push(t[a.value]):"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Type of token '"+a.type+"' and format of value '"+o+"' don't match!");break;case"unknown":"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Detect 'unknown' type of token!")}}return n}(n,t)},exports.capital=r,exports.title=o,exports.upper=a,exports.lower=u,exports.i18n=function(e,i){var c,l=i.dictionary,p=new s,f={},v=function(e,t,r,o){void 0===r&&(r=c),void 0===o&&(o=void 0);var a=n(f[r],e);if(!a)return e;if(o)for(var u=0,i=o.length;u<i;u++)a=o[u](a);return t&&(a=p.interpolate(a,t).join("")),a.trim()},h={capital:function(e,t,n){return r(v(e,t,n))},title:function(e,t,n){return o(v(e,t,n))},upper:function(e,t,n){return a(v(e,t,n))},lower:function(e,t,n){return u(v(e,t,n))},plural:function(e,t,n,r){return v(e,n,r,[function(e){var n="number"==typeof t?Math.min(Math.abs(t),2):0;return e.split("|")[n]}])}};return e.i18n={setLocale:function(t){e.fire("locale",t)},extendDictionary:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];f=t.all([f].concat(e))}},e.i18n.extendDictionary(l),e.on("locale",function(t){c=t;var n=v;Object.assign(n,h),e.set({locale:t,_:n})}),e};
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("deepmerge")),n=e(require("object-resolve-path")),r=function(e){return e.replace(/(^|\s)\S/,function(e){return e.toUpperCase()})},o=function(e){return e.replace(/(^|\s)\S/g,function(e){return e.toUpperCase()})},u=function(e){return e.toLocaleUpperCase()},a=function(e){return e.toLocaleLowerCase()},i=function(e){return null!==e&&"object"==typeof e},c=/^(\d)+/,l=/^(\w)+/,s=function(){this._caches=Object.create(null)};s.prototype.interpolate=function(e,t){if(!t)return[e];var n=this._caches[e];return n||(n=function(e){var t=[],n=0,r="";for(;n<e.length;){var o=e[n++];if("{"!==o||n>0&&"\\"===o[n-1])r+=o;else{r.length&&t.push({type:"text",value:r}),r="";var u="";for(o=e[n++];"}"!==o;)u+=o,o=e[n++];var a=c.test(u)?"list":l.test(u)?"named":"unknown";t.push({value:u,type:a})}}r&&t.push({type:"text",value:r});return t}(e),this._caches[e]=n),function(e,t){var n=[],r=0,o=Array.isArray(t)?"list":i(t)?"named":"unknown";if("unknown"===o)return n;for(;r<e.length;){var u=e[r++];switch(u.type){case"text":n.push(u.value);break;case"list":n.push(t[parseInt(u.value,10)]);break;case"named":"named"===o?n.push(t[u.value]):"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Type of token '"+u.type+"' and format of value '"+o+"' don't match!");break;case"unknown":"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Detect 'unknown' type of token!")}}return n}(n,t)},exports.capital=r,exports.title=o,exports.upper=u,exports.lower=a,exports.i18n=function(e,i){var c,l=i.dictionary,p=new s,f={},v=function(e,t,r,o){void 0===r&&(r=c),void 0===o&&(o=void 0);var u=n(f[r],e);if(!u)return e;if(o)for(var a=0,i=o.length;a<i;a++)u=o[a](u);return t&&(u=p.interpolate(u,t).join("")),u.trim()},h=function(e,t,n){return r(v(e,t,n))},d=function(e,t,n){return o(v(e,t,n))},y=function(e,t,n){return u(v(e,t,n))},w=function(e,t,n){return a(v(e,t,n))},k=function(e,t,n,r){return v(e,n,r,[function(e){var n="number"==typeof t?Math.min(Math.abs(t),2):0;return e.split("|")[n]}])};return e.on("locale",function(t){if(Object.keys(f).includes(t)){c=t;var n=v;n.upper=y,n.lower=w,n.title=d,n.capital=h,n.plural=k,e.set({locale:t,_:n})}else console.error("[svelte-i18n] Couldn't find the \""+t+'" locale.')}),e.i18n={setLocale:function(t){e.fire("locale",t)},extendDictionary:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];f=t.all([f].concat(e))}},e.i18n.extendDictionary(l),e};
//# sourceMappingURL=i18n.js.map

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

var n=function(n){return n.replace(/(^|\s)\S/,function(n){return n.toUpperCase()})},e=function(n){return n.replace(/(^|\s)\S/g,function(n){return n.toUpperCase()})},t=function(n){return n.toLocaleUpperCase()},r=function(n){return n.toLocaleLowerCase()},o=function(n){return null!==n&&"object"==typeof n};function a(n,e){"undefined"!=typeof console&&(console.warn("[svelte-i18n] "+n),e&&console.warn(e.stack))}var u=/^(\d)+/,c=/^(\w)+/,i=function(){this._caches=Object.create(null)};i.prototype.interpolate=function(n,e){if(!e)return[n];var t=this._caches[n];return t||(t=function(n){var e=[],t=0,r="";for(;t<n.length;){var o=n[t++];if("{"!==o||t>0&&"\\"===o[t-1])r+=o;else{r.length&&e.push({type:"text",value:r}),r="";var a="";for(o=n[t++];"}"!==o;)a+=o,o=n[t++];var i=u.test(a)?"list":c.test(a)?"named":"unknown";e.push({value:a,type:i})}}r&&e.push({type:"text",value:r});return e}(n),this._caches[n]=t),function(n,e){var t=[],r=0,u=Array.isArray(e)?"list":o(e)?"named":"unknown";if("unknown"===u)return t;for(;r<n.length;){var c=n[r++];switch(c.type){case"text":t.push(c.value);break;case"list":t.push(e[parseInt(c.value,10)]);break;case"named":"named"===u?t.push(e[c.value]):"production"!==process.env.NODE_ENV&&a("Type of token '"+c.type+"' and format of value '"+u+"' don't match!");break;case"unknown":"production"!==process.env.NODE_ENV&&a("Detect 'unknown' type of token!")}}return t}(t,e)};var l=function(n){return n};function p(o,a){var u,c=new i,p={},s=function(n,e,t,r){void 0===t&&(t=u),void 0===r&&(r=void 0);var o=l(p[t],n);if(!o)return n;if(r)for(var a=0,i=r.length;a<i;a++)o=r[a](o);return e&&(o=c.interpolate(o,e).join("")),o.trim()},f={capital:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n(s.apply(void 0,e))},title:function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return e(s.apply(void 0,n))},upper:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return t(s.apply(void 0,n))},lower:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return r(s.apply(void 0,n))},plural:function(n,e,t,r){return s(n,t,r,[function(n){return n.split("|")[Math.min(Math.abs(e),2)]}])}};return o.setLocale=function(n){return o.fire("locale",n)},o.on("locale",function(n){u=n;var e=s;Object.assign(e,f),o.set({locale:n,_:e})}),o}export{p as i18n};
import e from"deepmerge";import n from"object-resolve-path";var t=function(e){return e.replace(/(^|\s)\S/,function(e){return e.toUpperCase()})},r=function(e){return e.replace(/(^|\s)\S/g,function(e){return e.toUpperCase()})},o=function(e){return e.toLocaleUpperCase()},a=function(e){return e.toLocaleLowerCase()},u=function(e){return null!==e&&"object"==typeof e},i=/^(\d)+/,c=/^(\w)+/,l=function(){this._caches=Object.create(null)};function s(u,i){var c,s=i.dictionary,f=new l,p={},v=function(e,t,r,o){void 0===r&&(r=c),void 0===o&&(o=void 0);var a=n(p[r],e);if(!a)return e;if(o)for(var u=0,i=o.length;u<i;u++)a=o[u](a);return t&&(a=f.interpolate(a,t).join("")),a.trim()},h=function(e,n,r){return t(v(e,n,r))},d=function(e,n,t){return r(v(e,n,t))},y=function(e,n,t){return o(v(e,n,t))},m=function(e,n,t){return a(v(e,n,t))},w=function(e,n,t,r){return v(e,t,r,[function(e){var t="number"==typeof n?Math.min(Math.abs(n),2):0;return e.split("|")[t]}])};return u.on("locale",function(e){if(Object.keys(p).includes(e)){c=e;var n=v;n.upper=y,n.lower=m,n.title=d,n.capital=h,n.plural=w,u.set({locale:e,_:n})}else console.error("[svelte-i18n] Couldn't find the \""+e+'" locale.')}),u.i18n={setLocale:function(e){u.fire("locale",e)},extendDictionary:function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];p=e.all([p].concat(n))}},u.i18n.extendDictionary(s),u}l.prototype.interpolate=function(e,n){if(!n)return[e];var t=this._caches[e];return t||(t=function(e){var n=[],t=0,r="";for(;t<e.length;){var o=e[t++];if("{"!==o||t>0&&"\\"===o[t-1])r+=o;else{r.length&&n.push({type:"text",value:r}),r="";var a="";for(o=e[t++];"}"!==o;)a+=o,o=e[t++];var u=i.test(a)?"list":c.test(a)?"named":"unknown";n.push({value:a,type:u})}}r&&n.push({type:"text",value:r});return n}(e),this._caches[e]=t),function(e,n){var t=[],r=0,o=Array.isArray(n)?"list":u(n)?"named":"unknown";if("unknown"===o)return t;for(;r<e.length;){var a=e[r++];switch(a.type){case"text":t.push(a.value);break;case"list":t.push(n[parseInt(a.value,10)]);break;case"named":"named"===o?t.push(n[a.value]):"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Type of token '"+a.type+"' and format of value '"+o+"' don't match!");break;case"unknown":"production"!==process.env.NODE_ENV&&console.warn("[svelte-i18n] Detect 'unknown' type of token!")}}return t}(t,n)};export{t as capital,r as title,o as upper,a as lower,s as i18n};
//# sourceMappingURL=i18n.m.js.map
{
"name": "svelte-i18n",
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",
"main": "dist/i18n.js",
"module": "dist/i18n.m.js",
"types": "src/index.d.ts",
"description": "",
"description": "Internationalization library for Svelte",
"author": "Christian Kaisermann <christian@kaisermann.me>",
"repository": "https://github.com/kaisermann",
"keywords": [],
"keywords": [
"svelte",
"i18n",
"internationalization",
"localization",
"translation"
],
"scripts": {
"build": "microbundle --name='svelte-i18n'",
"start": "microbundle watch --name='svelte-i18n'",
"build": "microbundle --format=cjs,es",
"start": "microbundle watch --format=cjs,es",
"test": "jest --no-cache --verbose",

@@ -15,0 +22,0 @@ "test:watch": "jest --no-cache --verbose --watchAll",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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