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-rc.7 to 1.0.0-rc.8

4

dist/index.d.ts

@@ -46,5 +46,5 @@ import { Parser as Parser$1, Config as Config$1 } from '@sveltekit-i18n/base';

type AgoProps = {
'ago'?: (Intl.RelativeTimeFormatOptions & {
'ago'?: Intl.RelativeTimeFormatOptions & {
format?: Intl.RelativeTimeFormatUnit | 'auto';
});
};
};

@@ -51,0 +51,0 @@ type DateProps = {

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

var C=Object.defineProperty,A=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var w=(t,e,i)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,u=(t,e)=>{for(var i in e||(e={}))O.call(e,i)&&w(t,i,e[i]);if(k)for(var i of k(e))R.call(e,i)&&w(t,i,e[i]);return t},T=(t,e)=>A(t,j(e));var l=(t,e)=>{var i={};for(var r in t)O.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&k)for(var r of k(t))e.indexOf(r)<0&&R.call(t,r)&&(i[r]=t[r]);return i};var z=(t,e)=>{for(var i in e)C(t,i,{get:e[i],enumerable:!0})};var h={};z(h,{ago:()=>X,date:()=>J,eq:()=>$,gt:()=>U,gte:()=>G,lt:()=>L,lte:()=>E,ne:()=>B,number:()=>H});var x=(t,e)=>{let{modifierDefaults:i}=e||{},{[t]:r}=i||{};return r||{}};var $=({value:t,options:e=[],defaultValue:i=""})=>(e.find(({key:r})=>`${r}`.toLowerCase()===`${t}`.toLowerCase())||{}).value||i,B=({value:t,options:e=[],defaultValue:i=""})=>(e.find(({key:r})=>`${r}`.toLowerCase()!==`${t}`.toLowerCase())||{}).value||i,L=({value:t,options:e=[],defaultValue:i=""})=>(e.sort((o,n)=>+o.key-+n.key).find(({key:o})=>+t<+o)||{}).value||i,U=({value:t,options:e=[],defaultValue:i=""})=>(e.sort((o,n)=>+n.key-+o.key).find(({key:o})=>+t>+o)||{}).value||i,E=({value:t,options:e=[],defaultValue:i=""})=>$({value:t,options:e,defaultValue:L({value:t,options:e,defaultValue:i})}),G=({value:t,options:e=[],defaultValue:i=""})=>$({value:t,options:e,defaultValue:U({value:t,options:e,defaultValue:i})}),H=({value:t,props:e,defaultValue:i="",locale:r="",parserOptions:o})=>{if(!r)return"";let s=x("number",o),{maximumFractionDigits:n}=s,a=l(s,["maximumFractionDigits"]),d=(e==null?void 0:e.number)||{},{maximumFractionDigits:f=n||2}=d,m=l(d,["maximumFractionDigits"]);return new Intl.NumberFormat(r,u(T(u({},a),{maximumFractionDigits:f}),m)).format(+t||+i)},J=({value:t,props:e,defaultValue:i="",locale:r="",parserOptions:o})=>{if(!r)return"";let M=x("date",o),{dateStyle:n,timeStyle:a}=M,f=l(M,["dateStyle","timeStyle"]),c=(e==null?void 0:e.date)||{},{dateStyle:m=n||"medium",timeStyle:s=a||"short"}=c,d=l(c,["dateStyle","timeStyle"]);return new Intl.DateTimeFormat(r,u(T(u({},f),{dateStyle:m,timeStyle:s}),d)).format(+t||+i)},P=[{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}],Q=t=>P.indexOf(P.find(e=>e.key===t)),W=(t,e)=>P.reduce(([i,r],{key:o,multiplier:n},a)=>{if(console.log(o,r,i),r===e)return[i,r];if(!r||a===Q(r)+1){let f=Math.round(i/n);if(!r||Math.abs(f)>=1||e!=="auto")return[f,o]}return[i,r]},[t,""]),X=({value:t,defaultValue:e="",locale:i="",props:r,parserOptions:o})=>{if(!i)return"";let y=x("ago",o),{format:n,numeric:a}=y,f=l(y,["format","numeric"]),g=(r==null?void 0:r.ago)||{},{format:m=n||"auto",numeric:s=a||"auto"}=g,d=l(g,["format","numeric"]),M=(+t||+e)-Date.now(),c=W(M,m);return new Intl.RelativeTimeFormat(i,u(T(u({},f),{numeric:s}),d)).format(...c)};var Y=t=>typeof t=="string"&&/{{(?:(?!{{|}}).)+}}/.test(t),p=t=>typeof t=="string"?t.replace(/\\(?=:|;|{|})/g,""):t,Z=({value:t,props:e,payload:i,parserOptions:r,locale:o})=>`${t}`.replace(/{{\s*(?:(?!{{|}}).)+\s*}}/g,n=>{let a=p(`${n.match(/(?!{|\s).+?(?!\\[:;]).(?=\s*(?:[:;]|}}$))/)}`),f=i==null?void 0:i[a],[,m=""]=n.match(/.+?(?!\\;).;\s*default\s*:\s*([^\s:;].+?(?:\\[:;]|[^;\s}])*)(?=\s*(?:;|}}$))/i)||[];m=m||(i==null?void 0:i.default)||"";let[,s=""]=n.match(/{{\s*(?:[^;]|(?:\\;))+\s*(?:(?!\\:).[:])\s*(?!\s)((?:\\;|[^;])+?)(?=\s*(?:[;]|}}$))/i)||[];if(f===void 0&&s!=="ne")return m;let d=!!s,{customModifiers:M}=r||{},c=u(u({},h),M||{});s=Object.keys(c).includes(s)?s:"eq";let y=c[s],g=(n.match(/[^\s:;{](?:[^;]|\\[;])+[^\s:;}]/gi)||[]).reduce((F,b,N)=>{if(N>0){let D=p(`${b.match(/(?:(?:\\:)|[^:])+/)}`.trim()),I=`${b.match(/(?:(?:\\:)|[^:])+$/)}`.trim();if(D&&D!=="default"&&I)return[...F,{key:D,value:I}]}return F},[]);return!d&&!g.length?f:y({value:f,options:g,props:e,defaultValue:m,locale:o,parserOptions:r})}),q=({value:t,props:e,payload:i,parserOptions:r,locale:o})=>{if(Y(t)){let n=Z({value:t,payload:i,props:e,parserOptions:r,locale:o});return q({value:n,payload:i,props:e,parserOptions:r,locale:o})}else return p(t)},_=t=>({parse:(e,[i,r],o,n)=>((i==null?void 0:i.default)&&e===void 0&&(e=`${i.default}`),e===void 0&&(e=`${n}`),q({value:e,payload:i,props:r,parserOptions:t,locale:o}))}),et=_;export{et as default};
var C=Object.defineProperty,A=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var w=(t,e,i)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,u=(t,e)=>{for(var i in e||(e={}))O.call(e,i)&&w(t,i,e[i]);if(k)for(var i of k(e))R.call(e,i)&&w(t,i,e[i]);return t},T=(t,e)=>A(t,j(e));var l=(t,e)=>{var i={};for(var r in t)O.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&k)for(var r of k(t))e.indexOf(r)<0&&R.call(t,r)&&(i[r]=t[r]);return i};var v=(t,e)=>{for(var i in e)C(t,i,{get:e[i],enumerable:!0})};var h={};v(h,{ago:()=>W,date:()=>H,eq:()=>$,gt:()=>U,gte:()=>E,lt:()=>L,lte:()=>B,ne:()=>z,number:()=>G});var x=(t,e)=>{let{modifierDefaults:i}=e||{},{[t]:r}=i||{};return r||{}};var $=({value:t,options:e=[],defaultValue:i=""})=>(e.find(({key:r})=>`${r}`.toLowerCase()===`${t}`.toLowerCase())||{}).value||i,z=({value:t,options:e=[],defaultValue:i=""})=>(e.find(({key:r})=>`${r}`.toLowerCase()!==`${t}`.toLowerCase())||{}).value||i,L=({value:t,options:e=[],defaultValue:i=""})=>(e.sort((o,n)=>+o.key-+n.key).find(({key:o})=>+t<+o)||{}).value||i,U=({value:t,options:e=[],defaultValue:i=""})=>(e.sort((o,n)=>+n.key-+o.key).find(({key:o})=>+t>+o)||{}).value||i,B=({value:t,options:e=[],defaultValue:i=""})=>$({value:t,options:e,defaultValue:L({value:t,options:e,defaultValue:i})}),E=({value:t,options:e=[],defaultValue:i=""})=>$({value:t,options:e,defaultValue:U({value:t,options:e,defaultValue:i})}),G=({value:t,props:e,defaultValue:i="",locale:r="",parserOptions:o})=>{if(!r)return"";let s=x("number",o),{maximumFractionDigits:n}=s,a=l(s,["maximumFractionDigits"]),d=(e==null?void 0:e.number)||{},{maximumFractionDigits:f=n||2}=d,m=l(d,["maximumFractionDigits"]);return new Intl.NumberFormat(r,u(T(u({},a),{maximumFractionDigits:f}),m)).format(+t||+i)},H=({value:t,props:e,defaultValue:i="",locale:r="",parserOptions:o})=>{if(!r)return"";let M=x("date",o),{dateStyle:n,timeStyle:a}=M,f=l(M,["dateStyle","timeStyle"]),c=(e==null?void 0:e.date)||{},{dateStyle:m=n||"medium",timeStyle:s=a||"short"}=c,d=l(c,["dateStyle","timeStyle"]);return new Intl.DateTimeFormat(r,u(T(u({},f),{dateStyle:m,timeStyle:s}),d)).format(+t||+i)},P=[{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}],J=t=>P.indexOf(P.find(e=>e.key===t)),Q=(t,e)=>P.reduce(([i,r],{key:o,multiplier:n},a)=>{if(r===e)return[i,r];if(!r||a===J(r)+1){let f=Math.round(i/n);if(!r||Math.abs(f)>=1||e!=="auto")return[f,o]}return[i,r]},[t,""]),W=({value:t,defaultValue:e="",locale:i="",props:r,parserOptions:o})=>{if(!i)return"";let g=x("ago",o),{format:n,numeric:a}=g,f=l(g,["format","numeric"]),y=(r==null?void 0:r.ago)||{},{format:m=n||"auto",numeric:s=a||"auto"}=y,d=l(y,["format","numeric"]),M=(+t||+e)-Date.now(),c=Q(M,m);return new Intl.RelativeTimeFormat(i,u(T(u({},f),{numeric:s}),d)).format(...c)};var X=t=>typeof t=="string"&&/{{(?:(?!{{|}}).)+}}/.test(t),p=t=>typeof t=="string"?t.replace(/\\(?=:|;|{|})/g,""):t,Y=({value:t,props:e,payload:i,parserOptions:r,locale:o})=>`${t}`.replace(/{{\s*(?:(?!{{|}}).)+\s*}}/g,n=>{let a=p(`${n.match(/(?!{|\s).+?(?!\\[:;]).(?=\s*(?:[:;]|}}$))/)}`),f=i==null?void 0:i[a],[,m=""]=n.match(/.+?(?!\\;).;\s*default\s*:\s*([^\s:;].+?(?:\\[:;]|[^;\s}])*)(?=\s*(?:;|}}$))/i)||[];m=m||(i==null?void 0:i.default)||"";let[,s=""]=n.match(/{{\s*(?:[^;]|(?:\\;))+\s*(?:(?!\\:).[:])\s*(?!\s)((?:\\;|[^;])+?)(?=\s*(?:[;]|}}$))/i)||[];if(f===void 0&&s!=="ne")return m;let d=!!s,{customModifiers:M}=r||{},c=u(u({},h),M||{});s=Object.keys(c).includes(s)?s:"eq";let g=c[s],y=(n.match(/[^\s:;{](?:[^;]|\\[;])+[^\s:;}]/gi)||[]).reduce((F,b,N)=>{if(N>0){let D=p(`${b.match(/(?:(?:\\:)|[^:])+/)}`.trim()),I=`${b.match(/(?:(?:\\:)|[^:])+$/)}`.trim();if(D&&D!=="default"&&I)return[...F,{key:D,value:I}]}return F},[]);return!d&&!y.length?f:g({value:f,options:y,props:e,defaultValue:m,locale:o,parserOptions:r})}),q=({value:t,props:e,payload:i,parserOptions:r,locale:o})=>{if(X(t)){let n=Y({value:t,payload:i,props:e,parserOptions:r,locale:o});return q({value:n,payload:i,props:e,parserOptions:r,locale:o})}else return p(t)},Z=t=>({parse:(e,[i,r],o,n)=>((i==null?void 0:i.default)&&e===void 0&&(e=`${i.default}`),e===void 0&&(e=`${n}`),q({value:e,payload:i,props:r,parserOptions:t,locale:o}))}),et=Z;export{et as default};
{
"name": "@sveltekit-i18n/parser-default",
"version": "1.0.0-rc.7",
"version": "1.0.0-rc.8",
"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