Socket
Socket
Sign inDemoInstall

i18next

Package Overview
Dependencies
Maintainers
2
Versions
495
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next - npm Package Compare versions

Comparing version 23.7.12 to 23.7.13

2

dist/esm/package.json

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

{"type":"module","version":"23.7.12"}
{"type":"module","version":"23.7.13"}
{
"name": "i18next",
"version": "23.7.12",
"version": "23.7.13",
"description": "i18next internationalization framework",

@@ -121,3 +121,3 @@ "main": "./dist/cjs/i18next.js",

"scripts": {
"pretest": "npm run generate_ts_v4_index && npm run test:typescript && npm run test:typescript:customtypes && npm run test:typescript:defaulttypes && npm run test:typescript:fallbacktypes && npm run test:typescript:noninterop && npm run test:typescript:customcontextseparator",
"pretest": "npm run generate_ts_v4_index && npm run test:typescript && npm run test:typescript:customtypes && npm run test:typescript:customtypesjsonv3 && npm run test:typescript:defaulttypes && npm run test:typescript:fallbacktypes && npm run test:typescript:noninterop && npm run test:typescript:customcontextseparator && npm run test:typescript:manykeys",
"lint": "eslint src",

@@ -130,4 +130,6 @@ "test": "npm run lint && npm run test:new && npm run test:compat",

"test:typescript:customtypes": "tslint --project test/typescript/custom-types/tsconfig.json",
"test:typescript:customtypesjsonv3": "tslint --project test/typescript/custom-types-json-v3/tsconfig.json",
"test:typescript:fallbacktypes": "tslint --project test/typescript/fallback-types/tsconfig.json",
"test:typescript:customcontextseparator": "tslint --project test/typescript/custom-context-separator/tsconfig.json",
"test:typescript:manykeys": "tslint --project test/typescript/many-keys/tsconfig.json",
"test:typescript:noninterop": "tslint --project tsconfig.nonEsModuleInterop.json",

@@ -134,0 +136,0 @@ "tdd": "karma start karma.conf.js",

@@ -31,5 +31,7 @@ import type { $OmitArrayKeys, $PreservedValue, $Dictionary, $SpecialObject } from './helpers.js';

type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
type PluralSuffix = _JSONFormat extends 'v4'
? 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'
: number | 'plural';
type WithOrWithoutPlural<Key> = _JSONFormat extends 'v4'
type WithOrWithoutPlural<Key> = _JSONFormat extends 'v4' | 'v3'
? Key extends `${infer KeyWithoutOrdinalPlural}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`

@@ -147,9 +149,24 @@ ? KeyWithoutOrdinalPlural | Key

KeyWithPlural = `${Key & string}${_PluralSeparator}${PluralSuffix}`,
> = Res[(KeyWithPlural | Key) & keyof Res];
type ParseTReturnPluralOrdinal<
Res,
Key,
KeyWithOrdinalPlural = `${Key &
string}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`,
> = Res[(KeyWithOrdinalPlural | KeyWithPlural | Key) & keyof Res];
> = Res[(KeyWithOrdinalPlural | Key) & keyof Res];
type ParseTReturn<Key, Res> = Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
? ParseTReturn<RestKey, Res[K1 & keyof Res]>
: ParseTReturnPlural<Res, Key>;
type ParseTReturn<
Key,
Res,
TOpt extends TOptions = {},
> = Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
? ParseTReturn<RestKey, Res[K1 & keyof Res], TOpt>
: // Process plurals only if count is provided inside options
TOpt['count'] extends number
? TOpt['ordinal'] extends boolean
? ParseTReturnPluralOrdinal<Res, Key>
: ParseTReturnPlural<Res, Key>
: // otherwise access plain key without adding plural and ordinal suffixes
Res[Key & keyof Res];

@@ -176,4 +193,4 @@ type TReturnOptionalNull = _ReturnNull extends true ? null : never;

? ActualKey extends `${infer Nsp}${_NsSeparator}${infer RestKey}`
? ParseTReturn<RestKey, Resources[Nsp & keyof Resources]>
: ParseTReturn<ActualKey, Resources[$FirstNamespace<ActualNS>]>
? ParseTReturn<RestKey, Resources[Nsp & keyof Resources], TOpt>
: ParseTReturn<ActualKey, Resources[$FirstNamespace<ActualNS>], TOpt>
: DefaultTReturn<TOpt>;

@@ -180,0 +197,0 @@

@@ -31,5 +31,7 @@ import type { $OmitArrayKeys, $PreservedValue, $Dictionary, $SpecialObject } from './helpers.js';

type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
type PluralSuffix = _JSONFormat extends 'v4'
? 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'
: number | 'plural';
type WithOrWithoutPlural<Key> = _JSONFormat extends 'v4'
type WithOrWithoutPlural<Key> = _JSONFormat extends 'v4' | 'v3'
? Key extends `${infer KeyWithoutOrdinalPlural}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`

@@ -147,9 +149,24 @@ ? KeyWithoutOrdinalPlural | Key

KeyWithPlural = `${Key & string}${_PluralSeparator}${PluralSuffix}`,
> = Res[(KeyWithPlural | Key) & keyof Res];
type ParseTReturnPluralOrdinal<
Res,
Key,
KeyWithOrdinalPlural = `${Key &
string}${_PluralSeparator}ordinal${_PluralSeparator}${PluralSuffix}`,
> = Res[(KeyWithOrdinalPlural | KeyWithPlural | Key) & keyof Res];
> = Res[(KeyWithOrdinalPlural | Key) & keyof Res];
type ParseTReturn<Key, Res> = Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
? ParseTReturn<RestKey, Res[K1 & keyof Res]>
: ParseTReturnPlural<Res, Key>;
type ParseTReturn<
Key,
Res,
TOpt extends TOptions = {},
> = Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
? ParseTReturn<RestKey, Res[K1 & keyof Res], TOpt>
: // // Process plurals only if count is provided inside options
TOpt['count'] extends number
? TOpt['ordinal'] extends boolean
? ParseTReturnPluralOrdinal<Res, Key>
: ParseTReturnPlural<Res, Key>
: // otherwise access plain key without adding plural and ordinal suffixes
Res[Key & keyof Res];

@@ -176,4 +193,4 @@ type TReturnOptionalNull = _ReturnNull extends true ? null : never;

? ActualKey extends `${infer Nsp}${_NsSeparator}${infer RestKey}`
? ParseTReturn<RestKey, Resources[Nsp & keyof Resources]>
: ParseTReturn<ActualKey, Resources[$FirstNamespace<ActualNS>]>
? ParseTReturn<RestKey, Resources[Nsp & keyof Resources], TOpt>
: ParseTReturn<ActualKey, Resources[$FirstNamespace<ActualNS>], TOpt>
: DefaultTReturn<TOpt>;

@@ -180,0 +197,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc