svelte-common 6.6.9 → 6.6.10

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 +2 -2
  2. package/src/filter.mjs +22 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.6.9",
3
+ "version": "6.6.10",
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
 
@@ -76,7 +80,7 @@ function allOp(value, against, op) {
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
85
  if (value.match(i)) {
82
86
  return true;
@@ -100,7 +104,7 @@ function allOp(value, against, op) {
100
104
  }
101
105
  }
102
106
 
103
- if (Array.isArray(against) || against instanceof Set) {
107
+ if (against[Symbol.iterator]) {
104
108
  for (const i of against) {
105
109
  if (numberOp(value, i, op)) {
106
110
  return true;
@@ -110,6 +114,18 @@ function allOp(value, against, op) {
110
114
 
111
115
  return numberOp(value, against, op);
112
116
  case "boolean":
117
+ switch (typeof against) {
118
+ case "object":
119
+ if (against[Symbol.iterator]) {
120
+ for (const i of against) {
121
+ if (allOp(value, i, op)) {
122
+ return true;
123
+ }
124
+ }
125
+ }
126
+ break;
127
+ }
128
+
113
129
  return value == against;
114
130
  }
115
131