utils/json.js
/**
 * Similar to native JSON.parse but returns a promise and
 * runs jshint for more thorough error reporting
 */
Similar to native JSON.parse but returns a promise and
runs jshint for more thorough error reporting
Similar to native JSON . parse but returns a promise and runs jshint for more thorough error reporting
function parse(file, contents) {
  return new Promise(resolve => {
    let jsObj
    let err
    try {
      jsObj = JSON.parse(contents)
    } catch (exception) {
      err = exception
    } finally {
      if (err) {
        jshint(file, contents, function(issues) {
          resolve({ issues, parsed: null })
        })
      } else {
        resolve({ issues: [], parsed: jsObj })
      }
    }
  })
}
function parse ( file , contents ) { return new Promise ( resolve => { let jsObj let err try { jsObj = JSON . parse ( contents ) } catch ( exception ) { err = exception } finally { if ( err ) { jshint ( file , contents , function ( issues ) { resolve ( { issues , parsed : null } ) } ) } else { resolve ( { issues : [ ] , parsed : jsObj } ) } } } ) }
Similar to native JSON.parse but returns a promise and
 runs jshint for more thorough error reporting
Similar to native JSON . parse but returns a promise and runs jshint for more thorough error reporting