Describe the bug
These lines:
|
// very first iteration |
|
if (key === '') { |
assume objects cannot have keys
''. As we saw in
storybookjs/storybook#20755, that isn't a good assumption.
Steps to reproduce the behavior
## in node REPL
> const b = {}
undefined
> b[''] = { b: b}
<ref *1> { b: { '': [Circular *1] } }
> require('telejson').stringify(b)
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| <anonymous> -> object with constructor 'Object'
--- property 'b' closes the circle
at JSON.stringify (<anonymous>)
at Object.stringify (/Users/tom/GitHub/chromaui/chromatic/node_modules/telejson/dist/cjs/index.js:467:15)
Expected behavior
It should stringify correctly.
Describe the bug
These lines:
telejson/src/index.ts
Lines 149 to 150 in 6d2e7a4
''. As we saw in storybookjs/storybook#20755, that isn't a good assumption.Steps to reproduce the behavior
Expected behavior
It should stringify correctly.