svelte-common 4.19.1 → 4.19.2

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 +3 -3
  2. package/src/sorting.mjs +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "4.19.1",
3
+ "version": "4.19.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,10 +39,10 @@
39
39
  "@semantic-release/commit-analyzer": "^9.0.2",
40
40
  "@semantic-release/exec": "^6.0.3",
41
41
  "@semantic-release/release-notes-generator": "^10.0.3",
42
- "@sveltejs/vite-plugin-svelte": "^1.0.3",
42
+ "@sveltejs/vite-plugin-svelte": "^1.0.4",
43
43
  "ava": "^4.3.3",
44
44
  "documentation": "^14.0.0",
45
- "mf-styling": "^1.7.7",
45
+ "mf-styling": "^1.7.8",
46
46
  "npm-pkgbuild": "^10.14.8",
47
47
  "semantic-release": "^19.0.5",
48
48
  "stylelint": "^14.11.0",
package/src/sorting.mjs CHANGED
@@ -31,7 +31,7 @@ export function sortable(th, store) {
31
31
  );
32
32
 
33
33
  const button = document.createElement("button");
34
- button.setAttribute("aria-label", `sortable ${th.id}`);
34
+ button.setAttribute("aria-label", `toggle sort of ${th.id}`);
35
35
  const img = document.createElement("img");
36
36
  //img.setAttribute("alt", "sorting order indicator");
37
37
 
@@ -87,6 +87,7 @@ export function sorter(sortBy, getters = {}) {
87
87
  return (a, b) => {
88
88
  let av = getter(a);
89
89
  let bv = getter(b);
90
+
90
91
  if (av === undefined) {
91
92
  return -rev;
92
93
  }
@@ -96,11 +97,17 @@ export function sorter(sortBy, getters = {}) {
96
97
 
97
98
  switch (typeof av) {
98
99
  case "string":
99
- return typeof bv === "string" ? av.localeCompare(bv) : rev;
100
+ switch (typeof bv) {
101
+ case "number":
102
+ case "string":
103
+ return av.localeCompare(bv);
104
+ }
100
105
  }
101
106
 
102
107
  if (av instanceof Date) {
103
108
  av = av.getTime();
109
+ }
110
+ if (bv instanceof Date) {
104
111
  bv = bv.getTime();
105
112
  }
106
113