shevchenko 3.1.0-alpha.4 → 3.1.0-alpha.6

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 (70) hide show
  1. package/dist/cjs/anthroponym-declension/anthroponym-inflector.js +3 -1
  2. package/dist/cjs/anthroponym-declension/bootstrap.js +3 -1
  3. package/dist/cjs/anthroponym-declension/family-name-classifier/artifacts/model.bundle.json.js +2 -2
  4. package/dist/cjs/anthroponym-declension/family-name-classifier/cache/incorrect-predictions.json.js +1 -1
  5. package/dist/cjs/anthroponym-declension/family-name-classifier/family-name-class-transformer.js +3 -1
  6. package/dist/cjs/anthroponym-declension/family-name-classifier/family-name-classifer.js +7 -4
  7. package/dist/cjs/anthroponym-declension/family-name-classifier/model-bundle-loader.js +8 -6
  8. package/dist/cjs/anthroponym-declension/family-name-classifier/model-config.js +3 -1
  9. package/dist/cjs/anthroponym-declension/family-name-classifier/word-transformer.js +3 -1
  10. package/dist/cjs/anthroponym-declension/family-name-inflector.js +3 -1
  11. package/dist/cjs/anthroponym-declension/given-name-inflector.js +3 -1
  12. package/dist/cjs/anthroponym-declension/name-inflector.js +3 -1
  13. package/dist/cjs/anthroponym-declension/patronymic-name-inflector.js +3 -1
  14. package/dist/cjs/extension.js +11 -1
  15. package/dist/cjs/gender-detection/detect-gender.js +3 -1
  16. package/dist/cjs/gender-detection/given-names-genders.json.js +1 -1
  17. package/dist/cjs/index.js +6 -4
  18. package/dist/cjs/input-validation.js +29 -41
  19. package/dist/cjs/language/alphabet.js +3 -1
  20. package/dist/cjs/language/grammatical-case.js +3 -1
  21. package/dist/cjs/language/grammatical-gender.js +3 -1
  22. package/dist/cjs/language/letter-case.js +3 -1
  23. package/dist/cjs/language/linguistics.js +3 -1
  24. package/dist/cjs/language/word-class.js +3 -1
  25. package/dist/cjs/shevchenko.js +6 -4
  26. package/dist/cjs/word-declension/append-command-runner.js +3 -1
  27. package/dist/cjs/word-declension/bootstrap.js +3 -1
  28. package/dist/cjs/word-declension/command-runner-factory.js +3 -1
  29. package/dist/cjs/word-declension/declension-rule-inflector.js +3 -1
  30. package/dist/cjs/word-declension/declension-types.js +3 -1
  31. package/dist/cjs/word-declension/replace-command-runner.js +3 -1
  32. package/dist/cjs/word-declension/rules/artifacts/declension-rules.json.js +85 -1
  33. package/dist/cjs/word-declension/word-inflector.js +3 -1
  34. package/dist/es/anthroponym-declension/anthroponym-inflector.js +1 -1
  35. package/dist/es/anthroponym-declension/bootstrap.js +1 -1
  36. package/dist/es/anthroponym-declension/family-name-classifier/artifacts/model.bundle.json.js +1 -1
  37. package/dist/es/anthroponym-declension/family-name-classifier/cache/incorrect-predictions.json.js +1 -1
  38. package/dist/es/anthroponym-declension/family-name-classifier/family-name-class-transformer.js +1 -1
  39. package/dist/es/anthroponym-declension/family-name-classifier/family-name-classifer.js +1 -1
  40. package/dist/es/anthroponym-declension/family-name-classifier/model-bundle-loader.js +1 -1
  41. package/dist/es/anthroponym-declension/family-name-classifier/model-config.js +1 -1
  42. package/dist/es/anthroponym-declension/family-name-classifier/word-transformer.js +1 -1
  43. package/dist/es/anthroponym-declension/family-name-inflector.js +1 -1
  44. package/dist/es/anthroponym-declension/given-name-inflector.js +1 -1
  45. package/dist/es/anthroponym-declension/name-inflector.js +1 -1
  46. package/dist/es/anthroponym-declension/patronymic-name-inflector.js +1 -1
  47. package/dist/es/extension.d.ts +2 -2
  48. package/dist/es/extension.js +9 -2
  49. package/dist/es/gender-detection/detect-gender.js +1 -1
  50. package/dist/es/gender-detection/given-names-genders.json.js +1 -1
  51. package/dist/es/index.js +1 -1
  52. package/dist/es/input-validation.d.ts +2 -2
  53. package/dist/es/input-validation.js +27 -41
  54. package/dist/es/language/alphabet.js +1 -1
  55. package/dist/es/language/grammatical-case.js +1 -1
  56. package/dist/es/language/grammatical-gender.js +1 -1
  57. package/dist/es/language/letter-case.js +1 -1
  58. package/dist/es/language/linguistics.js +1 -1
  59. package/dist/es/language/word-class.js +1 -1
  60. package/dist/es/shevchenko.js +3 -2
  61. package/dist/es/word-declension/append-command-runner.js +1 -1
  62. package/dist/es/word-declension/bootstrap.js +1 -1
  63. package/dist/es/word-declension/command-runner-factory.js +1 -1
  64. package/dist/es/word-declension/declension-rule-inflector.js +1 -1
  65. package/dist/es/word-declension/declension-types.js +1 -1
  66. package/dist/es/word-declension/replace-command-runner.js +1 -1
  67. package/dist/es/word-declension/rules/artifacts/declension-rules.json.js +85 -1
  68. package/dist/es/word-declension/word-inflector.js +1 -1
  69. package/dist/umd/shevchenko.min.js +386 -305
  70. package/package.json +3 -2
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  class AnthroponymInflector {
13
15
  constructor(givenNameInflector, patronymicNameInflector, familyNameInflector) {
14
16
  this.givenNameInflector = givenNameInflector;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var bootstrap = require('../word-declension/bootstrap.js');
13
15
  var anthroponymInflector$1 = require('./anthroponym-inflector.js');
14
16
  var familyNameClassifer = require('./family-name-classifier/family-name-classifer.js');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -190,7 +190,7 @@ var modelBundle = {
190
190
  modelMetadata: modelMetadata
191
191
  };
192
192
 
193
- exports.default = modelBundle;
193
+ exports["default"] = modelBundle;
194
194
  exports.modelInfo = modelInfo;
195
195
  exports.modelMetadata = modelMetadata;
196
196
  exports.modelTopology = modelTopology;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  require('../../language/alphabet.js');
13
15
  var wordClass = require('../../language/word-class.js');
14
16
  require('../../language/grammatical-case.js');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,13 +9,16 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var tf = require('@tensorflow/tfjs');
13
15
  var incorrectPredictions = require('./cache/incorrect-predictions.json.js');
14
16
  var familyNameClassTransformer = require('./family-name-class-transformer.js');
15
17
  var modelConfig = require('./model-config.js');
16
18
  var wordTransformer = require('./word-transformer.js');
17
19
 
18
- function _interopNamespaceDefault(e) {
20
+ function _interopNamespace(e) {
21
+ if (e && e.__esModule) return e;
19
22
  var n = Object.create(null);
20
23
  if (e) {
21
24
  Object.keys(e).forEach(function (k) {
@@ -28,11 +31,11 @@ function _interopNamespaceDefault(e) {
28
31
  }
29
32
  });
30
33
  }
31
- n.default = e;
34
+ n["default"] = e;
32
35
  return Object.freeze(n);
33
36
  }
34
37
 
35
- var tf__namespace = /*#__PURE__*/_interopNamespaceDefault(tf);
38
+ var tf__namespace = /*#__PURE__*/_interopNamespace(tf);
36
39
 
37
40
  // Disable Node.js environment warning message in production code.
38
41
  // See https://github.com/tensorflow/tfjs/issues/5349
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var model_bundle = require('./artifacts/model.bundle.json.js');
13
15
 
14
16
  // Use Buffer on Node.js instead of Blob/atob/btoa
@@ -39,11 +41,11 @@ class ModelBundleLoader {
39
41
  */
40
42
  async load() {
41
43
  const out = {};
42
- out.modelTopology = model_bundle.default.modelTopology;
43
- out.weightSpecs = model_bundle.default.weightSpecs;
44
- out.weightData = base64StringToArrayBuffer(model_bundle.default.weightData);
45
- if (model_bundle.default.modelMetadata != null) {
46
- const metadata = model_bundle.default.modelMetadata;
44
+ out.modelTopology = model_bundle["default"].modelTopology;
45
+ out.weightSpecs = model_bundle["default"].weightSpecs;
46
+ out.weightData = base64StringToArrayBuffer(model_bundle["default"].weightData);
47
+ if (model_bundle["default"].modelMetadata != null) {
48
+ const metadata = model_bundle["default"].modelMetadata;
47
49
  out.format = metadata.format;
48
50
  out.generatedBy = metadata.generatedBy;
49
51
  out.convertedBy = metadata.convertedBy;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * The size of the model input vector.
14
16
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var alphabet = require('../../language/alphabet.js');
13
15
  require('../../language/word-class.js');
14
16
  require('../../language/grammatical-case.js');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  require('../language/alphabet.js');
13
15
  require('../language/word-class.js');
14
16
  var linguistics = require('../language/linguistics.js');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var nameInflector = require('./name-inflector.js');
13
15
 
14
16
  class GivenNameInflector extends nameInflector.NameInflector {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  class NameInflector {
13
15
  /**
14
16
  * Inflects the name in the given grammatical case.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var nameInflector = require('./name-inflector.js');
13
15
 
14
16
  class PatronymicNameInflector extends nameInflector.NameInflector {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var bootstrap = require('./word-declension/bootstrap.js');
13
15
 
14
16
  const registeredExtensions = [];
@@ -16,6 +18,13 @@ function registerExtension(extensionFactory) {
16
18
  const extension = extensionFactory({ wordInflector: bootstrap.wordInflector });
17
19
  registeredExtensions.push(extension);
18
20
  }
21
+ function getCustomFieldNames() {
22
+ const fieldNames = [];
23
+ for (const extension of registeredExtensions) {
24
+ fieldNames.push(...extension.fieldNames);
25
+ }
26
+ return fieldNames;
27
+ }
19
28
  async function afterInflect(grammaticalCase, input) {
20
29
  var _a;
21
30
  const output = {};
@@ -29,4 +38,5 @@ async function afterInflect(grammaticalCase, input) {
29
38
  }
30
39
 
31
40
  exports.afterInflect = afterInflect;
41
+ exports.getCustomFieldNames = getCustomFieldNames;
32
42
  exports.registerExtension = registerExtension;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  require('../language/alphabet.js');
13
15
  require('../language/word-class.js');
14
16
  require('../language/grammatical-case.js');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var shevchenko = require('./shevchenko.js');
13
15
  var inputValidation = require('./input-validation.js');
14
16
  var grammaticalCase = require('./language/grammatical-case.js');
@@ -28,15 +30,15 @@ exports.inLocative = shevchenko.inLocative;
28
30
  exports.inNominative = shevchenko.inNominative;
29
31
  exports.inVocative = shevchenko.inVocative;
30
32
  exports.InputValidationError = inputValidation.InputValidationError;
31
- Object.defineProperty(exports, "GrammaticalCase", {
33
+ Object.defineProperty(exports, 'GrammaticalCase', {
32
34
  enumerable: true,
33
35
  get: function () { return grammaticalCase.GrammaticalCase; }
34
36
  });
35
- Object.defineProperty(exports, "GrammaticalGender", {
37
+ Object.defineProperty(exports, 'GrammaticalGender', {
36
38
  enumerable: true,
37
39
  get: function () { return grammaticalGender.GrammaticalGender; }
38
40
  });
39
- Object.defineProperty(exports, "WordClass", {
41
+ Object.defineProperty(exports, 'WordClass', {
40
42
  enumerable: true,
41
43
  get: function () { return wordClass.WordClass; }
42
44
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,9 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
14
+ var extension = require('./extension.js');
12
15
  require('./language/alphabet.js');
13
16
  require('./language/word-class.js');
14
17
  require('./language/grammatical-case.js');
@@ -16,31 +19,30 @@ var grammaticalGender = require('./language/grammatical-gender.js');
16
19
 
17
20
  class InputValidationError extends TypeError {
18
21
  }
22
+ const fieldNames = ['givenName', 'patronymicName', 'familyName'];
19
23
  /**
20
24
  * Validates if a given value is a valid input for declension.
21
25
  *
22
26
  * @throws {InputValidationError}
23
27
  */
24
- function validateDeclensionInput(value) {
25
- if (!isObject(value)) {
28
+ function validateDeclensionInput(input) {
29
+ if (!isObject(input)) {
26
30
  throw new InputValidationError('The input type must be an object.');
27
31
  }
28
- if (!isIn(value.gender, Object.values(grammaticalGender.GrammaticalGender))) {
29
- throw new InputValidationError(`The "gender" parameter must be one of the following: "${grammaticalGender.GrammaticalGender.MASCULINE}", "${grammaticalGender.GrammaticalGender.FEMININE}".`);
30
- }
31
- if (!isDefined(value.givenName) &&
32
- !isDefined(value.patronymicName) &&
33
- !isDefined(value.familyName)) {
34
- throw new InputValidationError('At least one of the following parameters must present: "givenName", "patronymicName", "familyName".');
32
+ const isGenderValid = Object.values(grammaticalGender.GrammaticalGender).includes(input.gender);
33
+ if (!isGenderValid) {
34
+ throw new InputValidationError(`The "gender" parameter must be one of the following:` +
35
+ ` "${Object.values(grammaticalGender.GrammaticalGender).join('", "')}".`);
35
36
  }
36
- if (isDefined(value.givenName) && !isString(value.givenName)) {
37
- throw new InputValidationError('The "givenName" parameter must be a string.');
37
+ const mergedFieldNames = [...fieldNames, ...extension.getCustomFieldNames()];
38
+ const hasFields = mergedFieldNames.some((fieldName) => fieldName in input && typeof input[fieldName] !== 'undefined');
39
+ if (!hasFields) {
40
+ throw new InputValidationError(`At least one of the following parameters must present: "${mergedFieldNames.join('", "')}".`);
38
41
  }
39
- if (isDefined(value.patronymicName) && !isString(value.patronymicName)) {
40
- throw new InputValidationError('The "patronymicName" parameter must be a string.');
41
- }
42
- if (isDefined(value.familyName) && !isString(value.familyName)) {
43
- throw new InputValidationError('The "familyName" parameter must be a string.');
42
+ for (const fieldName of mergedFieldNames) {
43
+ if (fieldName in input && typeof input[fieldName] !== 'string') {
44
+ throw new InputValidationError(`The "${fieldName}" parameter must be a string.`);
45
+ }
44
46
  }
45
47
  }
46
48
  /**
@@ -48,36 +50,22 @@ function validateDeclensionInput(value) {
48
50
  *
49
51
  * @throws {InputValidationError}
50
52
  */
51
- function validateGenderDetectionInput(value) {
52
- if (!isObject(value)) {
53
+ function validateGenderDetectionInput(input) {
54
+ if (!isObject(input)) {
53
55
  throw new InputValidationError('The input type must be an object.');
54
56
  }
55
- if (!isDefined(value.givenName) &&
56
- !isDefined(value.patronymicName) &&
57
- !isDefined(value.familyName)) {
58
- throw new InputValidationError('At least one of the following parameters must present: "givenName", "patronymicName", "familyName".');
59
- }
60
- if (isDefined(value.givenName) && !isString(value.givenName)) {
61
- throw new InputValidationError('The "givenName" parameter must be a string.');
57
+ const hasFields = fieldNames.some((fieldName) => fieldName in input && typeof input[fieldName] !== 'undefined');
58
+ if (!hasFields) {
59
+ throw new InputValidationError(`At least one of the following parameters must present: "${fieldNames.join('", "')}".`);
62
60
  }
63
- if (isDefined(value.patronymicName) && !isString(value.patronymicName)) {
64
- throw new InputValidationError('The "patronymicName" parameter must be a string.');
61
+ for (const fieldName of fieldNames) {
62
+ if (fieldName in input && typeof input[fieldName] !== 'string') {
63
+ throw new InputValidationError(`The "${fieldName}" parameter must be a string.`);
64
+ }
65
65
  }
66
- if (isDefined(value.familyName) && !isString(value.familyName)) {
67
- throw new InputValidationError('The "familyName" parameter must be a string.');
68
- }
69
- }
70
- function isDefined(value) {
71
- return typeof value !== 'undefined';
72
66
  }
73
67
  function isObject(value) {
74
- return value != null && typeof value === 'object';
75
- }
76
- function isString(value) {
77
- return typeof value === 'string';
78
- }
79
- function isIn(value, values) {
80
- return values.includes(value);
68
+ return typeof value === 'object' && value != null;
81
69
  }
82
70
 
83
71
  exports.InputValidationError = InputValidationError;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * Ukrainian alphabet encoding where the key is the letter of the alphabet
14
16
  * and the value is the order number of the corresponding letter starting from 1.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * Enum representing the possible grammatical cases.
14
16
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * Enum representing the possible grammatical genders.
14
16
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * Copies a letter case pattern from a template word to a target word.
14
16
  * Returns a modified target word in the letter case of the template word.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  const PATTERN_VOWELS = /[аоуеиіяюєї]/gi;
13
15
  /**
14
16
  * Returns a number of syllables in a given word.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  /**
13
15
  * Enum representing the possible grammatical word classes (also known as part of speech).
14
16
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  var bootstrap = require('./anthroponym-declension/bootstrap.js');
13
15
  var extension = require('./extension.js');
14
16
  var detectGender$1 = require('./gender-detection/detect-gender.js');
@@ -170,15 +172,15 @@ async function detectGender(input) {
170
172
 
171
173
  exports.registerExtension = extension.registerExtension;
172
174
  exports.InputValidationError = inputValidation.InputValidationError;
173
- Object.defineProperty(exports, "WordClass", {
175
+ Object.defineProperty(exports, 'WordClass', {
174
176
  enumerable: true,
175
177
  get: function () { return wordClass.WordClass; }
176
178
  });
177
- Object.defineProperty(exports, "GrammaticalCase", {
179
+ Object.defineProperty(exports, 'GrammaticalCase', {
178
180
  enumerable: true,
179
181
  get: function () { return grammaticalCase.GrammaticalCase; }
180
182
  });
181
- Object.defineProperty(exports, "GrammaticalGender", {
183
+ Object.defineProperty(exports, 'GrammaticalGender', {
182
184
  enumerable: true,
183
185
  get: function () { return grammaticalGender.GrammaticalGender; }
184
186
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file JavaScript library for declension of Ukrainian anthroponyms
3
3
  * @module shevchenko
4
- * @version 3.1.0-alpha.3
4
+ * @version 3.1.0-alpha.6
5
5
  * @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
6
6
  * @license MIT
7
7
  * @copyright 2017-2024 Oleksandr Tolochko <shevchenko-js@tooleks.com>
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperty(exports, '__esModule', { value: true });
13
+
12
14
  class AppendCommandRunner {
13
15
  constructor(command) {
14
16
  this.command = command;