lib/plugins/JsonPlugin.js
function parseFile (args) {
    var file = args.file;
    var next = args.next;

    try {
      // Optimistically try to parse the file as JSON.
      return JSON.parse(file.data);
    }
    catch (error) {
      if (isJsonFile(file)) {
        // This is a JSON file, but its contents are invalid
        throw error;
      }
      else {
        // This probably isn't a JSON file, so call the next parser plugin
        next();
      }
    }
  }
function parseFile (args) {
    var file = args.file;
    var next = args.next;

    try {
      // Optimistically try to parse the file as JSON.
      return JSON.parse(file.data);
    }
    catch (error) {
      if (isJsonFile(file)) {
        // This is a JSON file, but its contents are invalid
        throw error;
      }
      else {
        // This probably isn't a JSON file, so call the next parser plugin
        next();
      }
    }
  }
function parseFile ( args ) { var file = args . file ; var next = args . next ; try { // Optimistically try to parse the file as JSON. return JSON . parse ( file . data ) ; } catch ( error ) { if ( isJsonFile ( file ) ) { // This is a JSON file, but its contents are invalid throw error ; } else { // This probably isn't a JSON file, so call the next parser plugin next ( ) ; } } }
Parses the given file's data, in place.

@param {File} args.file - The {@link File} to parse.
@param {function} args.next - Calls the next plugin, if the file data cannot be parsed
@returns {*}
Parses the given file s data in place .