svelte-common 6.6.11 → 6.6.12

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 +1 -1
  2. package/src/filter.mjs +9 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.6.11",
3
+ "version": "6.6.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/filter.mjs CHANGED
@@ -26,6 +26,10 @@ function allOp(value, against, op) {
26
26
 
27
27
  switch (typeof against) {
28
28
  case "object":
29
+ if (against instanceof Date && value instanceof Date) {
30
+ return dateOp(value, against, op);
31
+ }
32
+
29
33
  if (value[Symbol.toPrimitive] && against[Symbol.toPrimitive]) {
30
34
  return numberOp(
31
35
  value[Symbol.toPrimitive]("number"),
@@ -38,25 +42,15 @@ function allOp(value, against, op) {
38
42
  case "bigint":
39
43
  case "number":
40
44
  if (value[Symbol.toPrimitive]) {
41
- return allOp(
42
- value[Symbol.toPrimitive](typeof against),
43
- against,
44
- op
45
- );
45
+ return allOp(value[Symbol.toPrimitive]("number"), against, op);
46
46
  }
47
- }
47
+ break;
48
48
 
49
- if (value instanceof Date) {
50
- switch (typeof against) {
51
- case "string":
49
+ case "string":
50
+ if (value instanceof Date) {
52
51
  return dateOp(value, new Date(against), op);
53
- case "object":
54
- if (against instanceof Date) {
55
- return dateOp(value, against, op);
56
- }
57
- }
52
+ }
58
53
  }
59
-
60
54
  return value.toString().match(against);
61
55
  case "string":
62
56
  switch (typeof against) {