Skip to content
Myr

fix: protect isDraftable against undefined constructor (#969)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* protect against undefined constructor * add test case

authored by Brian Hung · committed by GitHub · parent 078e523 · Browse files · 2 files+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−1 removed

  • tests:+7 added−0 removed
  • other:+1 added−1 removed

2 files+8 added−1 removed

added:__tests__/isDraftable.js+7 added
modified:src/utils/common.ts+1 added-1 removed
25 unmodified lines
26 return (27 isPlainObject(value) ||28 Array.isArray(value) ||29 !!value[DRAFTABLE] ||30 !!value.constructor[DRAFTABLE] ||30 !!value.constructor?.[DRAFTABLE] ||31 isMap(value) ||32 isSet(value)33 )34}
183 unmodified lines