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

@sveltekit-i18n/parser-default

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltekit-i18n/parser-default - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

8

dist/index.d.ts

@@ -7,5 +7,7 @@ type ModifierOption = Record<'key' | 'value', string>;

type Parser = (config: {
type ParserOptions = {
customModifiers?: CustomModifiers;
}) => {
};
type Parser = (options: ParserOptions) => {
parse: (props: {

@@ -22,2 +24,2 @@ translations: Record<string, Record<string, any>>;

export { CustomModifiers, Modifier, ModifierOption, Parser, parser as default };
export { CustomModifiers, Modifier, ModifierOption, Parser, ParserOptions, parser as default };

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

var v=Object.defineProperty;var O=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var w=(e,t,i)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var i in t||(t={}))U.call(t,i)&&w(e,i,t[i]);if(O)for(var i of O(t))S.call(t,i)&&w(e,i,t[i]);return e};var L=(e,t)=>{for(var i in t)v(e,i,{get:t[i],enumerable:!0})};var p={};L(p,{ago:()=>B,date:()=>j,eq:()=>l,gt:()=>D,gte:()=>q,lt:()=>C,lte:()=>V,ne:()=>N,number:()=>E});var m=(e,t={})=>e||t,f=(e,t,i)=>{var r;return((r=e.find(n=>n.key===t))==null?void 0:r.value)||i};var l=(e,t=[],i="")=>m(t.find(({key:r})=>`${r}`.toLowerCase()===`${e}`.toLowerCase())).value||i,N=(e,t=[],i="")=>m(t.find(({key:r})=>`${r}`.toLowerCase()!==`${e}`.toLowerCase())).value||i,C=(e,t=[],i="")=>{let r=t.sort((n,s)=>+n.key-+s.key);return m(r.find(({key:n})=>+e<+n)).value||i},D=(e,t=[],i="")=>{let r=t.sort((n,s)=>+s.key-+n.key);return m(r.find(({key:n})=>+e>+n)).value||i},V=(e,t=[],i="")=>l(e,t,C(e,t,i)),q=(e,t=[],i="")=>l(e,t,D(e,t,i)),E=(e,t=[],i="",r="")=>r&&new Intl.NumberFormat(r,{maximumFractionDigits:f(t,"decimals",f(t,"maxDecimals","2")),minimumFractionDigits:f(t,"minDecimals")}).format(+e||+i),j=(e,t=[],i="",r="")=>r&&new Intl.DateTimeFormat(r,{dateStyle:f(t,"dateStyle","medium"),timeStyle:f(t,"timeStyle","short")}).format(+e||+i),c=[{key:"second",multiplier:1e3},{key:"minute",multiplier:60},{key:"hour",multiplier:60},{key:"day",multiplier:24},{key:"week",multiplier:7},{key:"month",multiplier:13/3},{key:"year",multiplier:12}],z=e=>c.indexOf(c.find(t=>t.key===e)),A=e=>c.reduce(([t,i],{key:r,multiplier:n},s)=>{if(!i||s===z(i)+1){let o=Math.round(t/n);if(!i||Math.abs(o)>=1)return[o,r]}return[t,i]},[e,""]),B=(e,t=[],i="",r="")=>{if(!r)return"";let n=f(t,"format","auto"),s=(+e||+i)-Date.now(),o=n==="auto"?A(s):[s,n];return new Intl.RelativeTimeFormat(r,{numeric:f(t,"numeric","auto"),style:f(t,"style","long")}).format(...o)};var G=(e="")=>/{{(?:(?!{{|}}).)+}}/.test(`${e}`),M=e=>e.replace(/\\(?=:|;|{|})/g,""),H=(e,t={},i={},r)=>e.replace(/{{\s*(?:(?!{{|}}).)+\s*}}/g,n=>{let s=M(`${n.match(/(?!{|\s).+?(?!\\[:;]).(?=\s*(?:[:;]|}}$))/)}`),o=t==null?void 0:t[s],[,y=""]=m(n.match(/.+?(?!\\;).;\s*default\s*:\s*([^\s:;].+?(?:\\[:;]|[^;\s}])*)(?=\s*(?:;|}}$))/i),[]),[,u=""]=m(n.match(/{{\s*(?:[^;]|(?:\\;))+\s*(?:(?!\\:).[:])\s*(?!\s)((?:\\;|[^;])+?)(?=\s*(?:[;]|}}$))/i),[]);if(o===void 0&&u!=="ne")return y;let R=!!u,g=d(d({},p),m(i));u=Object.keys(g).includes(u)?u:"eq";let b=g[u],$=m(n.match(/[^\s:;{](?:[^;]|\\[;])+[^\s:;}]/gi),[]).reduce((x,h,P)=>{if(P>0){let a=M(`${h.match(/(?:(?:\\:)|[^:])+/)}`.trim()),k=`${h.match(/(?:(?:\\:)|[^:])+$/)}`.trim();if(a&&a!=="default"&&k)return[...x,{key:a,value:k}]}return x},[]);return!R&&!$.length?`${o}`:b(o,$,y,r)}),I=(e,t={},i,r)=>{if(G(e)){let n=H(e,t,i,r);return I(n,t,i,r)}else return M(`${e}`)},J=({customModifiers:e={}}={})=>({parse:({translations:t={},key:i,payload:r,locale:n,fallbackLocale:s})=>{if(!i)throw new Error("No key provided to $t()");if(!n)throw new Error("No locale set!");let o=m(t[n])[i];return s&&o===void 0&&(o=m(t[s])[i]),(r==null?void 0:r.default)&&o===void 0&&(o=`${r.default}`),o===void 0&&(o=`${i}`),I(o,r,e,n)}}),Z=J;export{Z as default};
var v=Object.defineProperty;var k=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var w=(e,t,i)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var i in t||(t={}))U.call(t,i)&&w(e,i,t[i]);if(k)for(var i of k(t))S.call(t,i)&&w(e,i,t[i]);return e};var L=(e,t)=>{for(var i in t)v(e,i,{get:t[i],enumerable:!0})};var p={};L(p,{ago:()=>B,date:()=>j,eq:()=>l,gt:()=>D,gte:()=>q,lt:()=>C,lte:()=>V,ne:()=>N,number:()=>E});var m=(e,t={})=>e||t,f=(e,t,i)=>{var r;return((r=e.find(n=>n.key===t))==null?void 0:r.value)||i};var l=(e,t=[],i="")=>m(t.find(({key:r})=>`${r}`.toLowerCase()===`${e}`.toLowerCase())).value||i,N=(e,t=[],i="")=>m(t.find(({key:r})=>`${r}`.toLowerCase()!==`${e}`.toLowerCase())).value||i,C=(e,t=[],i="")=>{let r=t.sort((n,s)=>+n.key-+s.key);return m(r.find(({key:n})=>+e<+n)).value||i},D=(e,t=[],i="")=>{let r=t.sort((n,s)=>+s.key-+n.key);return m(r.find(({key:n})=>+e>+n)).value||i},V=(e,t=[],i="")=>l(e,t,C(e,t,i)),q=(e,t=[],i="")=>l(e,t,D(e,t,i)),E=(e,t=[],i="",r="")=>r&&new Intl.NumberFormat(r,{maximumFractionDigits:f(t,"decimals",f(t,"maxDecimals","2")),minimumFractionDigits:f(t,"minDecimals")}).format(+e||+i),j=(e,t=[],i="",r="")=>r&&new Intl.DateTimeFormat(r,{dateStyle:f(t,"dateStyle","medium"),timeStyle:f(t,"timeStyle","short")}).format(+e||+i),c=[{key:"second",multiplier:1e3},{key:"minute",multiplier:60},{key:"hour",multiplier:60},{key:"day",multiplier:24},{key:"week",multiplier:7},{key:"month",multiplier:13/3},{key:"year",multiplier:12}],z=e=>c.indexOf(c.find(t=>t.key===e)),A=e=>c.reduce(([t,i],{key:r,multiplier:n},s)=>{if(!i||s===z(i)+1){let o=Math.round(t/n);if(!i||Math.abs(o)>=1)return[o,r]}return[t,i]},[e,""]),B=(e,t=[],i="",r="")=>{if(!r)return"";let n=f(t,"format","auto"),s=(+e||+i)-Date.now(),o=n==="auto"?A(s):[s,n];return new Intl.RelativeTimeFormat(r,{numeric:f(t,"numeric","auto"),style:f(t,"style","long")}).format(...o)};var G=(e="")=>/{{(?:(?!{{|}}).)+}}/.test(`${e}`),M=e=>e.replace(/\\(?=:|;|{|})/g,""),H=(e,t={},i={},r)=>e.replace(/{{\s*(?:(?!{{|}}).)+\s*}}/g,n=>{let s=M(`${n.match(/(?!{|\s).+?(?!\\[:;]).(?=\s*(?:[:;]|}}$))/)}`),o=t==null?void 0:t[s],[,y=""]=m(n.match(/.+?(?!\\;).;\s*default\s*:\s*([^\s:;].+?(?:\\[:;]|[^;\s}])*)(?=\s*(?:;|}}$))/i),[]),[,u=""]=m(n.match(/{{\s*(?:[^;]|(?:\\;))+\s*(?:(?!\\:).[:])\s*(?!\s)((?:\\;|[^;])+?)(?=\s*(?:[;]|}}$))/i),[]);if(o===void 0&&u!=="ne")return y;let R=!!u,g=d(d({},p),m(i));u=Object.keys(g).includes(u)?u:"eq";let b=g[u],$=m(n.match(/[^\s:;{](?:[^;]|\\[;])+[^\s:;}]/gi),[]).reduce((x,O,P)=>{if(P>0){let a=M(`${O.match(/(?:(?:\\:)|[^:])+/)}`.trim()),h=`${O.match(/(?:(?:\\:)|[^:])+$/)}`.trim();if(a&&a!=="default"&&h)return[...x,{key:a,value:h}]}return x},[]);return!R&&!$.length?`${o}`:b(o,$,y,r)}),I=(e,t={},i,r)=>{if(G(e)){let n=H(e,t,i,r);return I(n,t,i,r)}else return M(`${e}`)},J=({customModifiers:e={}}={})=>({parse:({translations:t={},key:i,payload:r,locale:n,fallbackLocale:s})=>{if(!i)throw new Error("No key provided to $t()");if(!n)throw new Error("No locale set!");let o=m(t[n])[i];return s&&o===void 0&&(o=m(t[s])[i]),(r==null?void 0:r.default)&&o===void 0&&(o=`${r.default}`),o===void 0&&(o=`${i}`),I(o,r,e,n)}}),Z=J;export{Z as default};
{
"name": "@sveltekit-i18n/parser-default",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Default parser for sveltekit-i18n library.",

@@ -5,0 +5,0 @@ "type": "module",

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