How to use the js-beautify/js/lib/beautifier.min.js function in js-beautify

To help you get started, we’ve selected a few js-beautify 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 makajs / maka / packages / example / maka-app-store / apps / base / component / json-viewer / src / index.js View on Github external
import pkgJson from '../package.json'
import { actionMixin, registerAction, registerComponent } from 'maka'
import JSON5 from 'json5'
import beautify from 'js-beautify/js/lib/beautifier.min'
import JsonViewer from 'react-json-view'
import './style.less'

const name = pkgJson.name

registerAction('beautify', beautify, true)
registerAction('json5', JSON5, true)
registerComponent('JsonViewer', JsonViewer)


const strJson = beautify.js(JSON.stringify(JSON5.parse(`
{
    aa:1,
    bb:2
}`)))


const state = {
    data: {
        json: strJson
    }
}

@actionMixin('base')
class action {
    constructor(option) {
        Object.assign(this, option.mixins)
github makajs / maka / packages / example / maka-app-store / apps / base / component / json-viewer / src / index.js View on Github external
onViewerChange = (e) => {
        this.base.setState({
            'data.json': beautify.js(JSON.stringify(e.updated_src))
        })
    }