svelte-common 4.17.0 → 4.17.3

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/README.md CHANGED
@@ -59,12 +59,12 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
59
59
 
60
60
  ## sortable
61
61
 
62
- Add sortable toggle to a node.
62
+ Add sortable toggle button with img element to a node.
63
63
  Synchronizes store value with node "aria-sort" attribute.
64
64
 
65
65
  ### Parameters
66
66
 
67
- * `node` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** 
67
+ * `th` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** header node
68
68
  * `store`  
69
69
  * `to` **WritableStore** keep in sync with sorting properties
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "4.17.0",
3
+ "version": "4.17.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  "@sveltejs/vite-plugin-svelte": "^1.0.2",
43
43
  "ava": "^4.3.3",
44
44
  "documentation": "^14.0.0",
45
- "mf-styling": "^1.7.3",
45
+ "mf-styling": "^1.7.5",
46
46
  "npm-pkgbuild": "^10.14.8",
47
47
  "semantic-release": "^19.0.5",
48
48
  "stylelint": "^14.11.0",
@@ -52,7 +52,7 @@
52
52
  "vite": "^3.0.9"
53
53
  },
54
54
  "optionalDependencies": {
55
- "mf-hosting": "^1.7.2"
55
+ "mf-hosting": "^1.7.3"
56
56
  },
57
57
  "repository": {
58
58
  "type": "git",
package/src/filter.mjs CHANGED
@@ -1,9 +1,26 @@
1
1
  export function filter(filterBy, getters = {}) {
2
2
  if (filterBy) {
3
- for (const [key, value] of Object.entries(filterBy)) {
3
+ const filters = Object.entries(filterBy).map(([key, value]) => {
4
4
  const getter = getters[key] || (object => object && object[key]);
5
+ return a => {
6
+ const av = getter(a);
5
7
 
6
- return a => getter(a)?.match(value);
8
+ switch (typeof av) {
9
+ case "string":
10
+ return av.match(value);
11
+ case "number":
12
+ case "boolean":
13
+ return av == value;
14
+ }
15
+ return false;
16
+ };
17
+ });
18
+
19
+ if (filters.length === 1) {
20
+ return filters[0];
21
+ }
22
+ if (filters.length > 1) {
23
+ return a => !filters.some(f => !f(a));
7
24
  }
8
25
  }
9
26