svelte-common 6.6.8 → 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.
- package/package.json +6 -5
- 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.
|
|
3
|
+
"version": "6.6.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"start": "vite",
|
|
33
33
|
"test": "npm run test:ava && npm run test:cafe",
|
|
34
34
|
"test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs --esm -s build/test --page-request-timeout 5000 --app-init-delay 8000 --app vite",
|
|
35
|
-
"test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
36
|
-
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout
|
|
35
|
+
"test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs && ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
36
|
+
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
37
37
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
38
38
|
"lint": "npm run lint:css && npm run lint:docs",
|
|
39
39
|
"lint:docs": "documentation lint ./src/**/*.mjs",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"svelte-command": "^1.1.49",
|
|
45
|
-
"svelte-entitlement": "^1.2.
|
|
45
|
+
"svelte-entitlement": "^1.2.65"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
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.
|
|
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",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"${install.dir}": "build/",
|
|
80
80
|
"${install.dir}/anchor/": "tests/anchor/"
|
|
81
81
|
},
|
|
82
|
+
"csp.script-src": "script-src 'unsave-inline' 'self';",
|
|
82
83
|
"csp.script-src-elem": "script-src https://unpkg.com/ 'self';",
|
|
83
84
|
"example": true,
|
|
84
85
|
"frontend": true
|
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(
|
|
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 (
|
|
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 (
|
|
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
|
|