@ls-stack/utils 3.49.0 → 3.49.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.
@@ -452,9 +452,8 @@ function partialEqualInternal(target, sub, context) {
452
452
  }
453
453
  if (isComparison(sub) && sub["~sc"][0] === "keyNotBePresent") {
454
454
  addError(context, {
455
- message: "Key should not be present",
456
- received: target,
457
- expected: "key not present"
455
+ message: "This property should not be present",
456
+ received: target
458
457
  });
459
458
  return false;
460
459
  }
@@ -528,9 +527,9 @@ function partialEqualInternal(target, sub, context) {
528
527
  if (target instanceof Map && sub instanceof Map) {
529
528
  if (sub.size > target.size) {
530
529
  addError(context, {
531
- message: "Map too small",
532
- received: target,
533
- expected: sub
530
+ message: "Map has less entries than expected",
531
+ received: `${target.size} entries`,
532
+ expected: `${sub.size} entries`
534
533
  });
535
534
  return false;
536
535
  }
@@ -613,8 +612,7 @@ function partialEqualInternal(target, sub, context) {
613
612
  context.path = [...oldPath2, key];
614
613
  addError(context, {
615
614
  message: "Key should not be present",
616
- received: target[key],
617
- expected: "key not present"
615
+ received: target[key]
618
616
  });
619
617
  context.path = oldPath2;
620
618
  allMatch = false;
@@ -638,8 +636,8 @@ function partialEqualInternal(target, sub, context) {
638
636
  context.path = [...oldPath2, key];
639
637
  addError(context, {
640
638
  message: "Missing property",
641
- received: void 0,
642
- expected: sub[key]
639
+ expected: sub[key],
640
+ received: { objectWithKeys: Object.keys(target) }
643
641
  });
644
642
  context.path = oldPath2;
645
643
  allMatch = false;
@@ -680,7 +678,8 @@ function checkNoExtraKeys(target, partialShape, context, deep) {
680
678
  const oldPath = context.path;
681
679
  context.path = [...oldPath, key];
682
680
  addError(context, {
683
- message: `Extra key "${key}" not expected`
681
+ message: `Extra key "${key}" should not be present`,
682
+ received: target[key]
684
683
  });
685
684
  context.path = oldPath;
686
685
  return false;
@@ -721,7 +720,8 @@ function checkNoExtraDefinedKeys(target, partialShape, context, deep) {
721
720
  const oldPath = context.path;
722
721
  context.path = [...oldPath, key];
723
722
  addError(context, {
724
- message: `Extra defined key "${key}" not expected`
723
+ message: `Extra defined key "${key}" should not be present`,
724
+ received: target[key]
725
725
  });
726
726
  context.path = oldPath;
727
727
  return false;
@@ -425,9 +425,8 @@ function partialEqualInternal(target, sub, context) {
425
425
  }
426
426
  if (isComparison(sub) && sub["~sc"][0] === "keyNotBePresent") {
427
427
  addError(context, {
428
- message: "Key should not be present",
429
- received: target,
430
- expected: "key not present"
428
+ message: "This property should not be present",
429
+ received: target
431
430
  });
432
431
  return false;
433
432
  }
@@ -501,9 +500,9 @@ function partialEqualInternal(target, sub, context) {
501
500
  if (target instanceof Map && sub instanceof Map) {
502
501
  if (sub.size > target.size) {
503
502
  addError(context, {
504
- message: "Map too small",
505
- received: target,
506
- expected: sub
503
+ message: "Map has less entries than expected",
504
+ received: `${target.size} entries`,
505
+ expected: `${sub.size} entries`
507
506
  });
508
507
  return false;
509
508
  }
@@ -586,8 +585,7 @@ function partialEqualInternal(target, sub, context) {
586
585
  context.path = [...oldPath2, key];
587
586
  addError(context, {
588
587
  message: "Key should not be present",
589
- received: target[key],
590
- expected: "key not present"
588
+ received: target[key]
591
589
  });
592
590
  context.path = oldPath2;
593
591
  allMatch = false;
@@ -611,8 +609,8 @@ function partialEqualInternal(target, sub, context) {
611
609
  context.path = [...oldPath2, key];
612
610
  addError(context, {
613
611
  message: "Missing property",
614
- received: void 0,
615
- expected: sub[key]
612
+ expected: sub[key],
613
+ received: { objectWithKeys: Object.keys(target) }
616
614
  });
617
615
  context.path = oldPath2;
618
616
  allMatch = false;
@@ -653,7 +651,8 @@ function checkNoExtraKeys(target, partialShape, context, deep) {
653
651
  const oldPath = context.path;
654
652
  context.path = [...oldPath, key];
655
653
  addError(context, {
656
- message: `Extra key "${key}" not expected`
654
+ message: `Extra key "${key}" should not be present`,
655
+ received: target[key]
657
656
  });
658
657
  context.path = oldPath;
659
658
  return false;
@@ -694,7 +693,8 @@ function checkNoExtraDefinedKeys(target, partialShape, context, deep) {
694
693
  const oldPath = context.path;
695
694
  context.path = [...oldPath, key];
696
695
  addError(context, {
697
- message: `Extra defined key "${key}" not expected`
696
+ message: `Extra defined key "${key}" should not be present`,
697
+ received: target[key]
698
698
  });
699
699
  context.path = oldPath;
700
700
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ls-stack/utils",
3
3
  "description": "Universal TypeScript utilities for browser and Node.js",
4
- "version": "3.49.0",
4
+ "version": "3.49.1",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",