How to use safe-json-stringify - 7 common examples

To help you get started, we’ve selected a few safe-json-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 binarykitchen / videomail-client / src / wrappers / visuals / recorder.js View on Github external
function writeCommand (command, args, cb) {
    if (!cb && args && args.constructor === Function) {
      cb = args
      args = null
    }

    if (!connected) {
      debug('Reconnecting for the command', command, '…')

      initSocket(function () {
        writeCommand(command, args)
        cb && cb()
      })
    } else if (stream) {
      debug('$ %s', command, args ? stringify(args) : '')

      const commandObj = {
        command: command,
        args: args
      }

      // todo commented out because for some reasons server does not accept such a long
      // array of many log lines. to examine later.
      //
      // add some useful debug info to examine weird stuff like this one
      // UnprocessableError: Unable to encode a video with FPS near zero.
      // todo consider removing this later or have it for debug=1 only?
      //
      // if (options.logger && options.logger.getLines) {
      //   commandObj.logLines = options.logger.getLines()
      // }
github binarykitchen / videomail-client / src / util / pretty.js View on Github external
propertyNames.forEach(function (name) {
      if (excludes) {
        exclude = excludes.indexOf(name) >= 0
      }

      if (!exclude && object[name]) {
        // this to cover this problem:
        // https://github.com/binarykitchen/videomail-client/issues/157
        lines.push(stringify(object[name]))
      }
    })
  }
github binarykitchen / videomail-client / src / wrappers / visuals / recorder.js View on Github external
command: command,
        args: args
      }

      // todo commented out because for some reasons server does not accept such a long
      // array of many log lines. to examine later.
      //
      // add some useful debug info to examine weird stuff like this one
      // UnprocessableError: Unable to encode a video with FPS near zero.
      // todo consider removing this later or have it for debug=1 only?
      //
      // if (options.logger && options.logger.getLines) {
      //   commandObj.logLines = options.logger.getLines()
      // }

      writeStream(Buffer.from(stringify(commandObj)))

      if (cb) {
        // keep all callbacks async
        setTimeout(function () {
          cb()
        }, 0)
      }
    }
  }
github binarykitchen / videomail-client / src / wrappers / visuals / recorder.js View on Github external
function executeCommand (command) {
    try {
      debug(
        'Server commanded: %s',
        command.command,
        command.args ? ', ' + stringify(command.args) : ''
      )

      switch (command.command) {
        case 'ready':
          if (!userMediaTimeout) { loadUserMedia() }
          break
        case 'preview':
          preview(command.args)
          break
        case 'error':
          this.emit(Events.ERROR, VideomailError.create(
            'Oh no, server error!',
            command.args.err.toString() || '(No explanation given)',
            options
          ))
          break
github binarykitchen / videomail-client / src / wrappers / visuals / userMedia.js View on Github external
function logEvent (event, params) {
    options.debug('UserMedia: ...', EVENT_ASCII, 'event', event, stringify(params))
  }
github binarykitchen / videomail-client / src / util / pretty.js View on Github external
array.forEach(function (element) {
      if (element) {
        lines.push(stringify(element))
      }
    })
github geemaple / react-server-rendering-example / server_rendering / views / layout.jsx View on Github external
render(){
    if (typeof window == 'undefined') {//server rendering
      var contentHtml = ReactDOMServer.renderToString(<div>{this.props.children}</div>);
      var {settings, _locals, cache, children, propLink, propScript, ...parameters } = this.props;

      var cssStore;
      if (typeof propLink != 'undefined' &amp;&amp; propLink.length &gt; 0) {
        cssStore = propLink.map(function(linItem){
          return 
        });
      }

      var json = safeJsonStringify(parameters);
      var propStore = ;

      var scriptStore;
      if (typeof propScript != 'undefined' &amp;&amp; propScript.length &gt; 0) {
        scriptStore = propScript.map(function(scriptItem){
          return

safe-json-stringify

Prevent defined property getters from throwing errors

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Popular safe-json-stringify functions

Similar packages