lib/util/plugins.js
function getResult (obj, prop, file, callback) {
  var value = obj[prop];

  if (typeof value === "function") {
    return value.apply(obj, [file, callback]);
  }

  if (!callback) {
    // The synchronous plugin functions (canParse and canRead)
    // allow a "shorthand" syntax, where the user can match
    // files by RegExp or by file extension.
    if (value instanceof RegExp) {
      return value.test(file.url);
    }
    else if (typeof value === "string") {
      return value === file.extension;
    }
    else if (Array.isArray(value)) {
      return value.indexOf(file.extension) !== -1;
    }
  }

  return value;
}
function getResult (obj, prop, file, callback) {
  var value = obj[prop];

  if (typeof value === "function") {
    return value.apply(obj, [file, callback]);
  }

  if (!callback) {
    // The synchronous plugin functions (canParse and canRead)
    // allow a "shorthand" syntax, where the user can match
    // files by RegExp or by file extension.
    if (value instanceof RegExp) {
      return value.test(file.url);
    }
    else if (typeof value === "string") {
      return value === file.extension;
    }
    else if (Array.isArray(value)) {
      return value.indexOf(file.extension) !== -1;
    }
  }

  return value;
}
function getResult ( obj , prop , file , callback ) { var value = obj [ prop ] ; if ( typeof value === "function" ) { return value . apply ( obj , [ file , callback ] ) ; } if ( ! callback ) { // The synchronous plugin functions (canParse and canRead) // allow a "shorthand" syntax, where the user can match // files by RegExp or by file extension. if ( value instanceof RegExp ) { return value . test ( file . url ) ; } else if ( typeof value === "string" ) { return value === file . extension ; } else if ( Array . isArray ( value ) ) { return value . indexOf ( file . extension ) !== - 1 ; } } return value ; }
Returns the value of the given property.
If the property is a function, then the result of the function is returned.
If the value is a RegExp, then it will be tested against the file URL.
If the value is an aray, then it will be compared against the file extension.

@param   {object}   obj        - The object whose property/method is called
@param   {string}   prop       - The name of the property/method to invoke
@param   {object}   file       - A file info object, which will be passed to the method
@param   {function} [callback] - A callback function, which will be passed to the method
@returns {*}
Returns the value of the given property . If the property is a function then the result of the function is returned . If the value is a RegExp then it will be tested against the file URL . If the value is an aray then it will be compared against the file extension .