@kontur.candy/generator 4.287.0-readonly2.0 → 4.287.0

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -114659,6 +114659,40 @@ let FilterType;
114659
114659
 
114660
114660
  /***/ }),
114661
114661
 
114662
+ /***/ "./Engine/src/Helpers/StringHelpers.ts":
114663
+ /*!*********************************************!*\
114664
+ !*** ./Engine/src/Helpers/StringHelpers.ts ***!
114665
+ \*********************************************/
114666
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
114667
+
114668
+ "use strict";
114669
+ __webpack_require__.r(__webpack_exports__);
114670
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
114671
+ /* harmony export */ "splitLastOccurrence": () => (/* binding */ splitLastOccurrence),
114672
+ /* harmony export */ "pluralize": () => (/* binding */ pluralize)
114673
+ /* harmony export */ });
114674
+ /* harmony import */ var _Common_IntRangeUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Common/IntRangeUtils */ "./Common/IntRangeUtils.ts");
114675
+
114676
+ const splitLastOccurrence = (source, substring) => {
114677
+ const lastIndex = source.lastIndexOf(substring);
114678
+ let before = "";
114679
+ let after = "";
114680
+
114681
+ if (lastIndex !== -1) {
114682
+ before = source.slice(0, lastIndex);
114683
+ after = source.slice(lastIndex + 1);
114684
+ }
114685
+
114686
+ return [before, after];
114687
+ };
114688
+ const pluralize = (count, words, localizer) => {
114689
+ const cases = [2, 0, 1, 1, 1, 2];
114690
+ const x = count % 100 > 4 && count % 100 < 20 ? 2 : cases[(0,_Common_IntRangeUtils__WEBPACK_IMPORTED_MODULE_0__.clampUInt)(count % 10, 0, 5)];
114691
+ return count.toString() + " " + (localizer ? localizer.translate(words[x]) : words[x]);
114692
+ };
114693
+
114694
+ /***/ }),
114695
+
114662
114696
  /***/ "./Generator/src/common/CodeGeneration/ClassInstanceBuilder.ts":
114663
114697
  /*!*********************************************************************!*\
114664
114698
  !*** ./Generator/src/common/CodeGeneration/ClassInstanceBuilder.ts ***!
@@ -123148,7 +123182,7 @@ __webpack_require__.r(__webpack_exports__);
123148
123182
  /* harmony export */ "StringTypeMessageGenerator": () => (/* binding */ StringTypeMessageGenerator),
123149
123183
  /* harmony export */ "unique": () => (/* binding */ unique)
123150
123184
  /* harmony export */ });
123151
- /* harmony import */ var _Common_IntRangeUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/IntRangeUtils */ "./Common/IntRangeUtils.ts");
123185
+ /* harmony import */ var _Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Engine/src/Helpers/StringHelpers */ "./Engine/src/Helpers/StringHelpers.ts");
123152
123186
  /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
123153
123187
  /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
123154
123188
  /* harmony import */ var _RadexpPatched_radexp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./RadexpPatched/radexp */ "./Generator/src/common/SchemaRng/RadexpPatched/radexp.js");
@@ -123185,31 +123219,31 @@ class StringTypeMessageGenerator {
123185
123219
  });
123186
123220
  }
123187
123221
 
123188
- return `${valueMustConsistOf} ${this.pluralize(constraints.length, isNumbersOnly ? this.digitPluralForms : this.symbolPluralForms, localizer)}`;
123222
+ return `${valueMustConsistOf} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.length, isNumbersOnly ? this.digitPluralForms : this.symbolPluralForms, localizer)}`;
123189
123223
  }
123190
123224
 
123191
123225
  if (constraints.minLength != undefined && constraints.maxLength != undefined) {
123192
- return `${valueMustBe} ${inTheInterval} ${from} ${constraints.minLength} ${to} ${this.pluralize(constraints.maxLength, this.symbolPluralForms, localizer)}`;
123226
+ return `${valueMustBe} ${inTheInterval} ${from} ${constraints.minLength} ${to} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.maxLength, this.symbolPluralForms, localizer)}`;
123193
123227
  }
123194
123228
 
123195
123229
  if (constraints.maxLength != undefined) {
123196
- return `${valueMustBe} ${notMore} ${this.pluralize(constraints.maxLength, this.symbolPluralForms, localizer)}`;
123230
+ return `${valueMustBe} ${notMore} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.maxLength, this.symbolPluralForms, localizer)}`;
123197
123231
  }
123198
123232
 
123199
123233
  if (constraints.minLength != undefined) {
123200
- return `${valueMustBe} ${notLess} ${this.pluralize(constraints.minLength, this.symbolPluralForms, localizer)}`;
123234
+ return `${valueMustBe} ${notLess} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.minLength, this.symbolPluralForms, localizer)}`;
123201
123235
  }
123202
123236
 
123203
123237
  if (constraints.integerDigitsMaxCount != undefined) {
123204
- return `${numberCant} ${containMore} ${this.pluralize(constraints.integerDigitsMaxCount, this.digitPluralForms, localizer)} ${inIntegerPart}`;
123238
+ return `${numberCant} ${containMore} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.integerDigitsMaxCount, this.digitPluralForms, localizer)} ${inIntegerPart}`;
123205
123239
  }
123206
123240
 
123207
123241
  if (constraints.fractionalDigitsMaxCount != undefined) {
123208
- return `${numberCant} ${containMore} ${this.pluralize(constraints.fractionalDigitsMaxCount, this.digitPluralForms, localizer)} ${inFractionalPart}`;
123242
+ return `${numberCant} ${containMore} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.fractionalDigitsMaxCount, this.digitPluralForms, localizer)} ${inFractionalPart}`;
123209
123243
  }
123210
123244
 
123211
123245
  if (constraints.totalDigitsMaxCount != undefined) {
123212
- return `${numberCant} ${containMore} ${this.pluralize(constraints.totalDigitsMaxCount, this.digitPluralForms, localizer)}`;
123246
+ return `${numberCant} ${containMore} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(constraints.totalDigitsMaxCount, this.digitPluralForms, localizer)}`;
123213
123247
  }
123214
123248
 
123215
123249
  if (constraints.minInclusive != undefined) {
@@ -123231,7 +123265,7 @@ class StringTypeMessageGenerator {
123231
123265
 
123232
123266
  if (uniqValues.length === 1) {
123233
123267
  if (isNumbersOnly) {
123234
- return `${valueMustConsistOf} ${this.pluralize(uniqValues[0].length, this.digitPluralForms, localizer)}`;
123268
+ return `${valueMustConsistOf} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(uniqValues[0].length, this.digitPluralForms, localizer)}`;
123235
123269
  } else {
123236
123270
  return `${valueMustBe} ${inFormat}: ${uniqValues[0]}`;
123237
123271
  }
@@ -123240,7 +123274,7 @@ class StringTypeMessageGenerator {
123240
123274
  const uniqueLengths = Iterator.from(unique(uniqValues.map(x => x.length))).toArray();
123241
123275
  (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayIsNotEmpty)(uniqueLengths);
123242
123276
  uniqueLengths.sort((x, y) => Math.sign(x - y));
123243
- return `${valueMustConsistOf} ${uniqueLengths.slice(0, -1).join(", ")} ${or} ${this.pluralize(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.last(uniqueLengths), this.digitPluralForms, localizer)}`;
123277
+ return `${valueMustConsistOf} ${uniqueLengths.slice(0, -1).join(", ")} ${or} ${(0,_Engine_src_Helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_0__.pluralize)(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.last(uniqueLengths), this.digitPluralForms, localizer)}`;
123244
123278
  } else {
123245
123279
  if (uniqValues.length < 4) {
123246
123280
  return `${valueMustBe} ${inFormat}: ${uniqValues.slice(0, -1).join(", ")} ${or} ${uniqValues[uniqValues.length - 1]}`;
@@ -123270,12 +123304,6 @@ class StringTypeMessageGenerator {
123270
123304
  return localizer ? localizer.translate(messages[type]) : messages[type];
123271
123305
  }
123272
123306
 
123273
- static pluralize(count, words, localizer) {
123274
- const cases = [2, 0, 1, 1, 1, 2];
123275
- const x = count % 100 > 4 && count % 100 < 20 ? 2 : cases[(0,_Common_IntRangeUtils__WEBPACK_IMPORTED_MODULE_0__.clampUInt)(count % 10, 0, 5)];
123276
- return count.toString() + " " + (localizer ? localizer.translate(words[x]) : words[x]);
123277
- }
123278
-
123279
123307
  static *generateRegexValues(pattern, count) {
123280
123308
  const rangexp = new _RadexpPatched_radexp__WEBPACK_IMPORTED_MODULE_3__.RandExp(pattern);
123281
123309
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.287.0-readonly2.0",
3
+ "version": "4.287.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,