Closed WKBae closed 5 months ago
Good point! There is a utility function isObject
that tries to identify whether something is a plain object (and not a Date or Map or class or something). We'll have to refine that function to cater for this case.
Fixed now in v0.21.3
Code to reproduce
Cause
Object.create(null)
creates an object with noconstructor
set.estimateSerializedSize
recurses json and tests if one is object withvalue.constructor.name === 'Object'
, throwingTypeError: Cannot read properties of undefined (reading 'name')
on such objects. https://github.com/josdejong/svelte-jsoneditor/blob/278dac5b5bd957d14be4ce2821d4c4824227c229/src/lib/utils/typeUtils.ts#L9-L13 (Related issue: https://github.com/josdejong/svelte-jsoneditor/issues/321)Parse function of json-bigint creates object with
Object.create(null)
, causing the error when used as a custom parser of jsoneditor.