Skip to content

Commit e3ab1dd

Browse files
committed
fix: guard null/empty reducers
1 parent 012f36d commit e3ab1dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/stringify.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ export function stringify(value, reducers) {
3131

3232
/** @type {Array<{ key: string, fn: (value: any) => any }>} */
3333
const custom = [];
34-
for (const key of Object.getOwnPropertyNames(reducers)) {
35-
custom.push({ key, fn: reducers[key] });
34+
if (reducers) {
35+
for (const key of Object.getOwnPropertyNames(reducers)) {
36+
custom.push({ key, fn: reducers[key] });
37+
}
3638
}
3739

3840
/** @type {string[]} */

0 commit comments

Comments
 (0)