svelte-common 6.4.5 → 6.5.0

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.4.5",
3
+ "version": "6.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,13 +53,13 @@
53
53
  "c8": "^8.0.0",
54
54
  "documentation": "^14.0.2",
55
55
  "mf-styling": "^3.0.2",
56
- "npm-pkgbuild": "^11.10.1",
56
+ "npm-pkgbuild": "^11.10.4",
57
57
  "semantic-release": "^21.0.7",
58
58
  "stylelint": "^15.10.2",
59
59
  "stylelint-config-standard": "^34.0.0",
60
- "svelte": "^4.0.5",
60
+ "svelte": "^4.1.1",
61
61
  "testcafe": "^3.0.1",
62
- "vite": "^4.4.4"
62
+ "vite": "^4.4.5"
63
63
  },
64
64
  "optionalDependencies": {
65
65
  "mf-hosting-cloudflare": "^1.0.5",
package/src/attribute.mjs CHANGED
@@ -143,7 +143,7 @@ export function setAttribute(object, name, value) {
143
143
 
144
144
  /**
145
145
  * Deliver attribute value.
146
- * The name may be a property path like 'a.b.c'.
146
+ * The name may be a property path like 'a.b.c' or a[2]
147
147
  * @param {Object} object
148
148
  * @param {string} name
149
149
  * @returns {any} value associated with the given property name
package/src/filter.mjs CHANGED
@@ -17,6 +17,34 @@ 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
+ if (value instanceof Map) {
24
+ return collectionOp(value.keys(), against, op);
25
+ }
26
+
27
+ switch (typeof against) {
28
+ case "object":
29
+ if (value[Symbol.toPrimitive] && against[Symbol.toPrimitive]) {
30
+ return numberOp(
31
+ value[Symbol.toPrimitive]("number"),
32
+ against[Symbol.toPrimitive]("number"),
33
+ op
34
+ );
35
+ }
36
+ break;
37
+
38
+ case "number":
39
+ if (value[Symbol.toPrimitive]) {
40
+ return allOp(
41
+ value[Symbol.toPrimitive](typeof against),
42
+ against,
43
+ op
44
+ );
45
+ }
46
+ }
47
+
20
48
  if (value instanceof Date) {
21
49
  switch (typeof against) {
22
50
  case "string":
@@ -28,10 +56,6 @@ function allOp(value, against, op) {
28
56
  }
29
57
  }
30
58
 
31
- if (Array.isArray(value) || value instanceof Set) {
32
- return collectionOp(value, against, op);
33
- }
34
-
35
59
  return value.toString().match(against);
36
60
  case "string":
37
61
  switch (typeof against) {
@@ -42,7 +66,7 @@ function allOp(value, against, op) {
42
66
  if (against instanceof Date) {
43
67
  return dateOp(new Date(value), against, op);
44
68
  }
45
-
69
+
46
70
  if (against instanceof RegExp) {
47
71
  return against.test(value);
48
72
  }