svelte-common 4.18.0 → 4.18.1

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/util.mjs +8 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "4.18.0",
3
+ "version": "4.18.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  "@sveltejs/vite-plugin-svelte": "^1.0.3",
43
43
  "ava": "^4.3.3",
44
44
  "documentation": "^14.0.0",
45
- "mf-styling": "^1.7.6",
45
+ "mf-styling": "^1.7.7",
46
46
  "npm-pkgbuild": "^10.14.8",
47
47
  "semantic-release": "^19.0.5",
48
48
  "stylelint": "^14.11.0",
package/src/util.mjs CHANGED
@@ -105,12 +105,14 @@ export function keyPrefixStore(store, prefix) {
105
105
  const subscriptions = new Set();
106
106
 
107
107
  store.subscribe(prefixedKeyObject => {
108
- const object = Object.fromEntries(
109
- Object.entries(prefixedKeyObject).map(([k, v]) => [
110
- k.substring(prefix.length),
111
- v
112
- ])
113
- );
108
+ const object =
109
+ prefixedKeyObject === undefined
110
+ ? {}
111
+ : Object.fromEntries(
112
+ Object.entries(prefixedKeyObject)
113
+ .filter(([k, v]) => k.startsWith(prefix))
114
+ .map(([k, v]) => [k.substring(prefix.length), v])
115
+ );
114
116
 
115
117
  subscriptions.forEach(subscription => subscription(object));
116
118
  });