svelte-common 6.4.4 → 6.4.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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/filter.mjs +24 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.4.4",
3
+ "version": "6.4.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,11 +53,11 @@
53
53
  "c8": "^8.0.0",
54
54
  "documentation": "^14.0.2",
55
55
  "mf-styling": "^3.0.2",
56
- "npm-pkgbuild": "^11.10.1",
56
+ "npm-pkgbuild": "^11.10.3",
57
57
  "semantic-release": "^21.0.7",
58
58
  "stylelint": "^15.10.2",
59
59
  "stylelint-config-standard": "^34.0.0",
60
- "svelte": "^4.0.5",
60
+ "svelte": "^4.1.0",
61
61
  "testcafe": "^3.0.1",
62
62
  "vite": "^4.4.4"
63
63
  },
package/src/filter.mjs CHANGED
@@ -15,23 +15,29 @@ function collectionOp(value, against, op) {
15
15
  }
16
16
 
17
17
  function allOp(value, against, op) {
18
- switch (typeof against) {
18
+ switch (typeof value) {
19
19
  case "object":
20
- if (against instanceof Date) {
21
- switch (typeof value) {
22
- case "object":
23
- if (value instanceof Date) {
24
- return dateOp(value, against, op);
25
- }
26
- break;
27
- case "string":
28
- return dateOp(new Date(value), against, op);
29
- }
20
+ switch (typeof against) {
21
+ case "object":
22
+ if (value[Symbol.toPrimitive] && against[Symbol.toPrimitive]) {
23
+ return numberOp(
24
+ value[Symbol.toPrimitive]("number"),
25
+ against[Symbol.toPrimitive]("number"),
26
+ op
27
+ );
28
+ }
29
+ break;
30
+
31
+ case "number":
32
+ if (value[Symbol.toPrimitive]) {
33
+ return allOp(
34
+ value[Symbol.toPrimitive](typeof against),
35
+ against,
36
+ op
37
+ );
38
+ }
30
39
  }
31
- }
32
40
 
33
- switch (typeof value) {
34
- case "object":
35
41
  if (value instanceof Date) {
36
42
  switch (typeof against) {
37
43
  case "string":
@@ -54,6 +60,10 @@ function allOp(value, against, op) {
54
60
  case "number":
55
61
  return numberOp(value, against, op);
56
62
  case "object":
63
+ if (against instanceof Date) {
64
+ return dateOp(new Date(value), against, op);
65
+ }
66
+
57
67
  if (against instanceof RegExp) {
58
68
  return against.test(value);
59
69
  }
@@ -65,7 +75,6 @@ function allOp(value, against, op) {
65
75
  if (against instanceof RegExp) {
66
76
  return against.test(value);
67
77
  }
68
-
69
78
  return numberOp(value, against, op);
70
79
  case "boolean":
71
80
  return value == against;