svelte-common 6.6.9 → 6.6.11

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.9",
3
+ "version": "6.6.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -48,7 +48,7 @@
48
48
  "@semantic-release/commit-analyzer": "^10.0.4",
49
49
  "@semantic-release/exec": "^6.0.3",
50
50
  "@semantic-release/release-notes-generator": "^11.0.7",
51
- "@sveltejs/vite-plugin-svelte": "^2.4.5",
51
+ "@sveltejs/vite-plugin-svelte": "^2.4.6",
52
52
  "ava": "^5.3.1",
53
53
  "c8": "^8.0.1",
54
54
  "documentation": "^14.0.2",
package/src/filter.mjs CHANGED
@@ -17,12 +17,12 @@ function collectionOp(value, against, op) {
17
17
  function allOp(value, against, op) {
18
18
  switch (typeof value) {
19
19
  case "object":
20
- if (Array.isArray(value) || value instanceof Set) {
21
- return collectionOp(value, against, op);
22
- }
23
20
  if (value instanceof Map) {
24
21
  return collectionOp(value.keys(), against, op);
25
22
  }
23
+ if (value[Symbol.iterator]) {
24
+ return collectionOp(value, against, op);
25
+ }
26
26
 
27
27
  switch (typeof against) {
28
28
  case "object":
@@ -38,7 +38,11 @@ function allOp(value, against, op) {
38
38
  case "bigint":
39
39
  case "number":
40
40
  if (value[Symbol.toPrimitive]) {
41
- return allOp(value[Symbol.toPrimitive](typeof against), against, op);
41
+ return allOp(
42
+ value[Symbol.toPrimitive](typeof against),
43
+ against,
44
+ op
45
+ );
42
46
  }
43
47
  }
44
48
 
@@ -70,46 +74,63 @@ function allOp(value, against, op) {
70
74
 
71
75
  if (against instanceof Map) {
72
76
  for (const [k, v] of against) {
73
- if (value.match(k) || value.match(v)) {
77
+ if (allOp(value, k, op) || allOp(value, v, op)) {
74
78
  return true;
75
79
  }
76
80
  }
77
81
  }
78
82
 
79
- if (Array.isArray(against) || against instanceof Set) {
83
+ if (against[Symbol.iterator]) {
80
84
  for (const i of against) {
81
- if (value.match(i)) {
85
+ if (allOp(value, i, op)) {
82
86
  return true;
83
87
  }
84
88
  }
89
+ return false;
85
90
  }
86
91
  }
87
92
 
88
93
  return value.match(against);
89
94
  case "bigint":
90
95
  case "number":
91
- if (against instanceof RegExp) {
92
- return against.test(value);
93
- }
96
+ switch (typeof against) {
97
+ case "object":
98
+ if (against instanceof RegExp) {
99
+ return against.test(value);
100
+ }
94
101
 
95
- if (against instanceof Map) {
96
- for (const [k, v] of against) {
97
- if (numberOp(value, k, op) || numberOp(value, v, op)) {
98
- return true;
102
+ if (against instanceof Map) {
103
+ for (const [k, v] of against) {
104
+ if (numberOp(value, k, op) || numberOp(value, v, op)) {
105
+ return true;
106
+ }
107
+ }
108
+ return false;
99
109
  }
100
- }
101
- }
102
110
 
103
- if (Array.isArray(against) || against instanceof Set) {
104
- for (const i of against) {
105
- if (numberOp(value, i, op)) {
106
- return true;
111
+ if (against[Symbol.iterator]) {
112
+ for (const i of against) {
113
+ if (numberOp(value, i, op)) {
114
+ return true;
115
+ }
116
+ }
117
+ return false;
107
118
  }
108
- }
109
119
  }
110
-
111
120
  return numberOp(value, against, op);
112
121
  case "boolean":
122
+ switch (typeof against) {
123
+ case "object":
124
+ if (against[Symbol.iterator]) {
125
+ for (const i of against) {
126
+ if (allOp(value, i, op)) {
127
+ return true;
128
+ }
129
+ }
130
+ }
131
+ break;
132
+ }
133
+
113
134
  return value == against;
114
135
  }
115
136
 
@@ -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
  }