svelte-common 6.6.10 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.6.10",
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) {
@@ -74,7 +68,7 @@ function allOp(value, against, op) {
74
68
 
75
69
  if (against instanceof Map) {
76
70
  for (const [k, v] of against) {
77
- if (value.match(k) || value.match(v)) {
71
+ if (allOp(value, k, op) || allOp(value, v, op)) {
78
72
  return true;
79
73
  }
80
74
  }
@@ -82,36 +76,41 @@ function allOp(value, against, op) {
82
76
 
83
77
  if (against[Symbol.iterator]) {
84
78
  for (const i of against) {
85
- if (value.match(i)) {
79
+ if (allOp(value, i, op)) {
86
80
  return true;
87
81
  }
88
82
  }
83
+ return false;
89
84
  }
90
85
  }
91
86
 
92
87
  return value.match(against);
93
88
  case "bigint":
94
89
  case "number":
95
- if (against instanceof RegExp) {
96
- return against.test(value);
97
- }
90
+ switch (typeof against) {
91
+ case "object":
92
+ if (against instanceof RegExp) {
93
+ return against.test(value);
94
+ }
98
95
 
99
- if (against instanceof Map) {
100
- for (const [k, v] of against) {
101
- if (numberOp(value, k, op) || numberOp(value, v, op)) {
102
- return true;
96
+ if (against instanceof Map) {
97
+ for (const [k, v] of against) {
98
+ if (numberOp(value, k, op) || numberOp(value, v, op)) {
99
+ return true;
100
+ }
101
+ }
102
+ return false;
103
103
  }
104
- }
105
- }
106
104
 
107
- if (against[Symbol.iterator]) {
108
- for (const i of against) {
109
- if (numberOp(value, i, op)) {
110
- return true;
105
+ if (against[Symbol.iterator]) {
106
+ for (const i of against) {
107
+ if (numberOp(value, i, op)) {
108
+ return true;
109
+ }
110
+ }
111
+ return false;
111
112
  }
112
- }
113
113
  }
114
-
115
114
  return numberOp(value, against, op);
116
115
  case "boolean":
117
116
  switch (typeof against) {
@@ -108,6 +108,9 @@ export class Pagination {
108
108
  return () => this.#subscriptions.delete(s);
109
109
  }
110
110
 
111
+ /**
112
+ * @return {number}
113
+ */
111
114
  get numberOfPages() {
112
115
  let n;
113
116
 
@@ -124,6 +127,11 @@ export class Pagination {
124
127
  return Math.ceil(n / this.itemsPerPage);
125
128
  }
126
129
 
130
+ /**
131
+ * Deliver items per page.
132
+ * @see {itemsPerPage}
133
+ * @return {number}
134
+ */
127
135
  get length() {
128
136
  return this.#itemsPerPage;
129
137
  }