@yamato-daiwa/es-extensions 1.9.0 → 1.9.1

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.
@@ -28,15 +28,14 @@ function getObjectPropertySafely(targetObject, dotSeparatedOrArrayedPathToTarget
28
28
  targetPropertyPathSegments = (0, splitString_1.default)(dotSeparatedOrArrayedPathToTargetProperty, ".");
29
29
  }
30
30
  else {
31
- Logger_1.default.logError({
32
- errorType: InvalidParameterValueError_1.default.NAME,
33
- title: InvalidParameterValueError_1.default.localization.defaultTitle,
34
- description: InvalidParameterValueError_1.default.localization.generateDescription({
31
+ Logger_1.default.throwErrorWithFormattedMessage({
32
+ errorInstance: new InvalidParameterValueError_1.default({
35
33
  parameterNumber: 2,
36
34
  parameterName: "dotSeparatedOrArrayedPathToTargetProperty",
37
35
  messageSpecificPart: "This parameter must be either a non-empty string, or a non-negative integer, or a non-empty array " +
38
36
  "of strings and/or non-negative integers."
39
37
  }),
38
+ title: InvalidParameterValueError_1.default.localization.defaultTitle,
40
39
  occurrenceLocation: "getObjectPropertySafely(targetObject, dotSeparatedOrArrayedPathToTargetProperty)"
41
40
  });
42
41
  return;
@@ -326,7 +326,9 @@ class RawObjectDataProcessor {
326
326
  }
327
327
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
328
328
  rawData__currentObjectDepth =
329
- (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
329
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
330
+ (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
331
+ rawData__full;
330
332
  }
331
333
  }
332
334
  if (childPropertySpecification.undefinedForbiddenIf.predicate({
@@ -369,7 +371,9 @@ class RawObjectDataProcessor {
369
371
  }
370
372
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
371
373
  rawData__currentObjectDepth =
372
- (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
374
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
375
+ (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
376
+ rawData__full;
373
377
  }
374
378
  }
375
379
  if (childPropertySpecification.mustBeUndefinedIf?.predicate({
@@ -432,7 +436,9 @@ class RawObjectDataProcessor {
432
436
  }
433
437
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
434
438
  rawData__currentObjectDepth =
435
- (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
439
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
440
+ (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
441
+ rawData__full;
436
442
  }
437
443
  }
438
444
  if (childPropertySpecification.nullForbiddenIf.predicate({
@@ -475,7 +481,9 @@ class RawObjectDataProcessor {
475
481
  }
476
482
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
477
483
  rawData__currentObjectDepth =
478
- (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1).join("."));
484
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
485
+ (0, getObjectPropertySafely_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1).join(".")) :
486
+ rawData__full;
479
487
  }
480
488
  }
481
489
  if (childPropertySpecification.mustBeNullIf?.predicate({
@@ -22,15 +22,14 @@ export default function getObjectPropertySafely(targetObject, dotSeparatedOrArra
22
22
  targetPropertyPathSegments = splitString(dotSeparatedOrArrayedPathToTargetProperty, ".");
23
23
  }
24
24
  else {
25
- Logger.logError({
26
- errorType: InvalidParameterValueError.NAME,
27
- title: InvalidParameterValueError.localization.defaultTitle,
28
- description: InvalidParameterValueError.localization.generateDescription({
25
+ Logger.throwErrorWithFormattedMessage({
26
+ errorInstance: new InvalidParameterValueError({
29
27
  parameterNumber: 2,
30
28
  parameterName: "dotSeparatedOrArrayedPathToTargetProperty",
31
29
  messageSpecificPart: "This parameter must be either a non-empty string, or a non-negative integer, or a non-empty array " +
32
30
  "of strings and/or non-negative integers."
33
31
  }),
32
+ title: InvalidParameterValueError.localization.defaultTitle,
34
33
  occurrenceLocation: "getObjectPropertySafely(targetObject, dotSeparatedOrArrayedPathToTargetProperty)"
35
34
  });
36
35
  return;
@@ -321,7 +321,9 @@ class RawObjectDataProcessor {
321
321
  }
322
322
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
323
323
  rawData__currentObjectDepth =
324
- getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
324
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
325
+ getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
326
+ rawData__full;
325
327
  }
326
328
  }
327
329
  if (childPropertySpecification.undefinedForbiddenIf.predicate({
@@ -364,7 +366,9 @@ class RawObjectDataProcessor {
364
366
  }
365
367
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
366
368
  rawData__currentObjectDepth =
367
- getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
369
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
370
+ getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
371
+ rawData__full;
368
372
  }
369
373
  }
370
374
  if (childPropertySpecification.mustBeUndefinedIf?.predicate({
@@ -427,7 +431,9 @@ class RawObjectDataProcessor {
427
431
  }
428
432
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
429
433
  rawData__currentObjectDepth =
430
- getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1));
434
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
435
+ getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
436
+ rawData__full;
431
437
  }
432
438
  }
433
439
  if (childPropertySpecification.nullForbiddenIf.predicate({
@@ -470,7 +476,9 @@ class RawObjectDataProcessor {
470
476
  }
471
477
  case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
472
478
  rawData__currentObjectDepth =
473
- getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1).join("."));
479
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
480
+ getObjectPropertySafely(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1).join(".")) :
481
+ rawData__full;
474
482
  }
475
483
  }
476
484
  if (childPropertySpecification.mustBeNullIf?.predicate({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamato-daiwa/es-extensions",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "Helper functions and classes aimed to reduce the routine code. Build-in TypeScript type safety.",
5
5
  "keywords": [
6
6
  "typescript",