Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: guard null/empty reducers
  • Loading branch information
danielroe committed Sep 25, 2024
commit e3ab1dd526c42473f87643fde247f38372666c07
6 changes: 4 additions & 2 deletions src/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export function stringify(value, reducers) {

/** @type {Array<{ key: string, fn: (value: any) => any }>} */
const custom = [];
for (const key of Object.getOwnPropertyNames(reducers)) {
custom.push({ key, fn: reducers[key] });
if (reducers) {
for (const key of Object.getOwnPropertyNames(reducers)) {
custom.push({ key, fn: reducers[key] });
}
}

/** @type {string[]} */
Expand Down