@koine/i18n 2.0.0-beta.71 → 2.0.0-beta.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.cjs.js CHANGED
@@ -486,7 +486,7 @@ let a$3 = (e)=>{
486
486
  }), l;
487
487
  };
488
488
  let transformKeysForPlurals = (l)=>{
489
- if (l.some(isPluralKey) || l.includes(i$3)) {
489
+ if (l.some(hasRequiredPluralSuffix) || l.includes(i$3)) {
490
490
  let r = l.filter(isPluralKey);
491
491
  if (r.length) {
492
492
  let t = [
@@ -501,12 +501,13 @@ let transformKeysForPlurals = (l)=>{
501
501
  }
502
502
  return l;
503
503
  };
504
- let hasPlurals = (e)=>Object.keys(e).some(isPluralKey) || Object.keys(e).includes(i$3);
504
+ let hasRequiredPluralSuffix = (e)=>isPluralKey(e) && getPluralSuffix(e) === i$3;
505
+ let hasPlurals = (e)=>Object.keys(e).some(hasRequiredPluralSuffix) || Object.keys(e).includes(i$3);
505
506
  let hasOnlyPluralKeys = (e)=>!!hasPlurals(e) && 0 === pickNonPluralKeys(e).length;
506
507
  let pickNonPluralKeys = (e)=>Object.keys(e).filter((e)=>!isPluralSuffix(e));
507
508
  let pickNonPluralValue = (e)=>hasPlurals(e) ? utils.objectPick(e, pickNonPluralKeys(e)) : e;
508
509
 
509
- let c$1 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasOnlyPluralKeys(a) ? `"${e}": string;` : `"${e}": string | ${h$2(pickNonPluralValue(a))}` : `"${e}": ${h$2(a)}`, h$2 = (e)=>{
510
+ let c$1 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasOnlyPluralKeys(a) ? `"${e}": string;` : `"${e}": ${h$2(pickNonPluralValue(a))}` : `"${e}": ${h$2(a)}`, h$2 = (e)=>{
510
511
  let o = "", i = "";
511
512
  if (utils.isBoolean(e) ? i = "boolean" : utils.isString(e) && (i = "string"), i) o += i + ";";
512
513
  else if (e) {
package/api.esm.js CHANGED
@@ -464,7 +464,7 @@ let a$3 = (e)=>{
464
464
  }), l;
465
465
  };
466
466
  let transformKeysForPlurals = (l)=>{
467
- if (l.some(isPluralKey) || l.includes(i$3)) {
467
+ if (l.some(hasRequiredPluralSuffix) || l.includes(i$3)) {
468
468
  let r = l.filter(isPluralKey);
469
469
  if (r.length) {
470
470
  let t = [
@@ -479,12 +479,13 @@ let transformKeysForPlurals = (l)=>{
479
479
  }
480
480
  return l;
481
481
  };
482
- let hasPlurals = (e)=>Object.keys(e).some(isPluralKey) || Object.keys(e).includes(i$3);
482
+ let hasRequiredPluralSuffix = (e)=>isPluralKey(e) && getPluralSuffix(e) === i$3;
483
+ let hasPlurals = (e)=>Object.keys(e).some(hasRequiredPluralSuffix) || Object.keys(e).includes(i$3);
483
484
  let hasOnlyPluralKeys = (e)=>!!hasPlurals(e) && 0 === pickNonPluralKeys(e).length;
484
485
  let pickNonPluralKeys = (e)=>Object.keys(e).filter((e)=>!isPluralSuffix(e));
485
486
  let pickNonPluralValue = (e)=>hasPlurals(e) ? objectPick(e, pickNonPluralKeys(e)) : e;
486
487
 
487
- let c$1 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKeys(a) ? `"${e}": string;` : `"${e}": string | ${h$2(pickNonPluralValue(a))}` : `"${e}": ${h$2(a)}`, h$2 = (e)=>{
488
+ let c$1 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKeys(a) ? `"${e}": string;` : `"${e}": ${h$2(pickNonPluralValue(a))}` : `"${e}": ${h$2(a)}`, h$2 = (e)=>{
488
489
  let o = "", i = "";
489
490
  if (isBoolean(e) ? i = "boolean" : isString(e) && (i = "string"), i) o += i + ";";
490
491
  else if (e) {
@@ -8,6 +8,7 @@ export declare let removePluralSuffix: (key: PluralKey) => string;
8
8
  export declare let getPluralSuffix: (key: PluralKey) => `${number}` | "zero" | "one" | "two" | "few" | "many" | "other";
9
9
  export declare let isPluralKey: (key: string) => key is `${string}_${number}` | `${string}_zero` | `${string}_one` | `${string}_two` | `${string}_few` | `${string}_many` | `${string}_other`;
10
10
  export declare let transformKeysForPlurals: (keys: string[]) => string[];
11
+ export declare let hasRequiredPluralSuffix: (key: string) => boolean;
11
12
  export declare let hasPlurals: (value: {
12
13
  [key: string]: I18nCompiler.DataTranslationValue;
13
14
  }) => boolean;
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "@koine/i18n",
3
3
  "sideEffects": false,
4
4
  "dependencies": {
5
- "@koine/node": "2.0.0-beta.71",
6
- "@koine/utils": "2.0.0-beta.71",
5
+ "@koine/node": "2.0.0-beta.72",
6
+ "@koine/utils": "2.0.0-beta.72",
7
7
  "glob": "^10.3.10",
8
8
  "webpack": "^5.90.1",
9
9
  "minimatch": "^9.0.3",
@@ -58,5 +58,5 @@
58
58
  },
59
59
  "module": "./index.esm.js",
60
60
  "main": "./index.cjs.js",
61
- "version": "2.0.0-beta.71"
61
+ "version": "2.0.0-beta.72"
62
62
  }