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

rosetty

Package Overview
Dependencies
Maintainers
0
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetty - npm Package Compare versions

Comparing version 3.0.76 to 3.1.0

4

dist/index.d.ts

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

import { Locale, format, formatRelative, formatDistance, formatDistanceToNow, formatDuration } from 'date-fns';
import { Locale, format, formatRelative, formatDistance, formatDistanceStrict, formatDistanceToNow, formatDistanceToNowStrict, formatDuration } from 'date-fns';

@@ -23,3 +23,5 @@ type BreakDownObject<O, R = void> = {

formatDistance: (date: number | Date, baseDate: number | Date, options?: Parameters<typeof formatDistance>[2]) => string;
formatDistanceStrict: (date: number | Date, baseDate: number | Date, options?: Parameters<typeof formatDistanceStrict>[2]) => string;
formatDistanceToNow: (date: number | Date, options?: Parameters<typeof formatDistanceToNow>[1]) => string;
formatDistanceToNowStrict: (date: number | Date, options?: Parameters<typeof formatDistanceToNowStrict>[1]) => string;
formatDuration: (duration: object, options?: Parameters<typeof formatDuration>[1]) => string;

@@ -26,0 +28,0 @@ }

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

import{format as g,formatDistance as d,formatDistanceToNow as p,formatDuration as b,formatRelative as D}from"date-fns";import f from"rosetta";var O=(i,l,s)=>{let n=i,o,a;if(typeof i!="object")throw new Error("rosetty: data must be an object with at least one language");n=Object.keys(n).reduce((t,e)=>(typeof n[e]=="object"&&typeof n[e].dict=="object"&&typeof n[e].locale=="object"&&(t[e]=n[e]),t),{});let m=f(Object.entries(n)?.map(([t,e])=>[t,e.dict])?.reduce((t,[e,r])=>({...t,[e]:r}),{})),u=t=>{if(!n[t])throw new Error(`rosetty: language ${t} not found`);o=n[t],a=t,m.locale(t)};return l&&u(l),{changeLang:u,languages:Object.keys(n),getCurrentLang:()=>a,t:(t,e,r)=>{if(a)if(r){let c=f(r);return c.locale(a),c.t(t,e)||(s?t:void 0)}else return m.t(t,e)||(s?t:void 0);else return s?t:void 0},displayNames:(t,e)=>new Intl.DisplayNames([o?.locale.code],e).of(t),listFormat:(t,e)=>new Intl.ListFormat(o?.locale.code,e).format(t),numberFormat:(t,e)=>new Intl.NumberFormat(o?.locale.code,e).format(t),pluralRules:(t,e)=>new Intl.PluralRules(o?.locale.code,e).select(t),format:(t,e,r)=>g(t,e,{...r,locale:o.locale}),formatRelative:(t,e,r)=>D(t,e,{...r,locale:o.locale}),formatDistance:(t,e,r)=>d(t,e,{...r,locale:o.locale}),formatDistanceToNow:(t,e)=>p(t,{...e,locale:o.locale}),formatDuration:(t,e)=>b(t,{...e,locale:o.locale})}};export{O as rosetty};
import{format as g,formatDistance as d,formatDistanceStrict as D,formatDistanceToNow as p,formatDistanceToNowStrict as b,formatDuration as y,formatRelative as R}from"date-fns";import u from"rosetta";var N=(i,m,s)=>{let a=i,r,n;if(typeof i!="object")throw new Error("rosetty: data must be an object with at least one language");a=Object.keys(a).reduce((t,e)=>(typeof a[e]=="object"&&typeof a[e].dict=="object"&&typeof a[e].locale=="object"&&(t[e]=a[e]),t),{});let c=u(Object.entries(a)?.map(([t,e])=>[t,e.dict])?.reduce((t,[e,o])=>({...t,[e]:o}),{})),l=t=>{if(!a[t])throw new Error(`rosetty: language ${t} not found`);r=a[t],n=t,c.locale(t)};return m&&l(m),{changeLang:l,languages:Object.keys(a),getCurrentLang:()=>n,t:(t,e,o)=>{if(n)if(o){let f=u(o);return f.locale(n),f.t(t,e)||(s?t:void 0)}else return c.t(t,e)||(s?t:void 0);else return s?t:void 0},displayNames:(t,e)=>new Intl.DisplayNames([r?.locale.code],e).of(t),listFormat:(t,e)=>new Intl.ListFormat(r?.locale.code,e).format(t),numberFormat:(t,e)=>new Intl.NumberFormat(r?.locale.code,e).format(t),pluralRules:(t,e)=>new Intl.PluralRules(r?.locale.code,e).select(t),format:(t,e,o)=>g(t,e,{...o,locale:r.locale}),formatRelative:(t,e,o)=>R(t,e,{...o,locale:r.locale}),formatDistance:(t,e,o)=>d(t,e,{...o,locale:r.locale}),formatDistanceStrict:(t,e,o)=>D(t,e,{...o,locale:r.locale}),formatDistanceToNow:(t,e)=>p(t,{...e,locale:r.locale}),formatDistanceToNowStrict:(t,e)=>b(t,{...e,locale:r.locale}),formatDuration:(t,e)=>y(t,{...e,locale:r.locale})}};export{N as rosetty};
{
"version": "3.0.76",
"version": "3.1.0",
"license": "MIT",

@@ -24,5 +24,3 @@ "main": "./dist/index.cjs",

"test": "jest",
"lint": "eslint src test",
"size": "size-limit",
"analyze": "size-limit --why"
"lint": "eslint src test"
},

@@ -43,12 +41,2 @@ "husky": {

"module": "./dist/index.js",
"size-limit": [
{
"path": "dist/rosetty.cjs.production.min.js",
"limit": "300 KB"
},
{
"path": "dist/rosetty.esm.js",
"limit": "200 KB"
}
],
"jest": {

@@ -67,3 +55,2 @@ "collectCoverage": true,

"@jest/globals": "29.7.0",
"@size-limit/preset-small-lib": "11.1.4",
"@types/jest": "29.5.12",

@@ -81,3 +68,2 @@ "@typescript-eslint/eslint-plugin": "7.16.0",

"prettier": "3.3.3",
"size-limit": "11.1.4",
"ts-jest": "^29.1.0",

@@ -107,3 +93,4 @@ "tsdx": "0.14.1",

"typesVersions": {},
"type": "module"
"type": "module",
"packageManager": "pnpm@8.15.8+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392"
}

@@ -9,3 +9,5 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

formatDistance,
formatDistanceStrict,
formatDistanceToNow,
formatDistanceToNowStrict,
formatDuration,

@@ -75,2 +77,7 @@ formatRelative,

) => string;
formatDistanceStrict: (
date: number | Date,
baseDate: number | Date,
options?: Parameters<typeof formatDistanceStrict>[2]
) => string;
formatDistanceToNow: (

@@ -80,2 +87,6 @@ date: number | Date,

) => string;
formatDistanceToNowStrict: (
date: number | Date,
options?: Parameters<typeof formatDistanceToNowStrict>[1]
) => string;
formatDuration: (

@@ -210,2 +221,11 @@ duration: object,

}),
formatDistanceStrict: (
date: number | Date,
baseDate: number | Date,
options?: Parameters<typeof formatDistanceStrict>[2]
) =>
formatDistanceStrict(date, baseDate, {
...options,
locale: actualConfig!.locale,
}),
formatDistanceToNow: (

@@ -216,2 +236,10 @@ date: number | Date,

formatDistanceToNow(date, { ...options, locale: actualConfig!.locale }),
formatDistanceToNowStrict: (
date: number | Date,
options?: Parameters<typeof formatDistanceToNowStrict>[1]
) =>
formatDistanceToNowStrict(date, {
...options,
locale: actualConfig!.locale,
}),
formatDuration: (

@@ -218,0 +246,0 @@ duration: object,

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