Skip to content

Commit

Permalink
display undefined in the playground
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpospiech committed Jun 18, 2024
1 parent 407cd21 commit 4915960
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion website/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import styles from '../lib/styles';
import { themes } from '../lib/universal';
import { compress, parseQuery, updateQuery } from '../lib/utils';

function replacer(key: string, value: any) {
return value === undefined ? 'undefined' : value;
}

export class Playground extends Component<any, any> {
static getDerivedStateFromError(error: Error) {
return { error };
Expand Down Expand Up @@ -116,7 +120,12 @@ const PlaygroundModelDebug = () => {
<br />
<br />
<pre>
<code>{`const model = ${JSON.stringify(model, null, 2)};`}</code>
<code>
{`const model = ${JSON.stringify(model, replacer, 2)};`.replace(
/"undefined"/g,
'undefined',
)}
</code>
</pre>
</>
);
Expand Down

0 comments on commit 4915960

Please sign in to comment.