How to use the javascript-stringify.stringifyObject function in javascript-stringify

To help you get started, we’ve selected a few javascript-stringify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amalto / platform6-ui-components / typescript / custom / PropsRenderer.tsx View on Github external
size="small"
                        color="light"
                        underlined
                        title={showSpaces(unquote(prop.defaultValue.value))}>
                        Function
                    
                } else if (propName === 'shape' || propName === 'object') {
                    try {
                        // We eval source code to be able to format the defaultProp here. This
                        // can be considered safe, as it is the source code that is evaled,
                        // which is from a known source and safe by default
                        // eslint-disable-next-line no-eval
                        const object = eval(`(${prop.defaultValue.value})`)

                        return (
                            
                        )
                    } catch (e) {
                        // eval will throw if it contains a reference to a property not in the
                        // local scope. To avoid any breakage we fall back to rendering the
                        // prop without any formatting
                        return (
                            
                        )
                    }
                }
            }

javascript-stringify

Stringify is to `eval` as `JSON.stringify` is to `JSON.parse`

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis