lib/meta/index.js
function scrapeMetadatum ($, url, rules) {
  if (!Array.isArray(rules)) rules = [rules]

  return rules.reduce(function (promise, rule) {
    return promise.then(function (value) {
      if (value != null && value !== '') return value
      var next = rule($, url)
      if (next != null && next !== '') return next
      return null
    })
  }, Promise.resolve())
}
function scrapeMetadatum ($, url, rules) {
  if (!Array.isArray(rules)) rules = [rules]

  return rules.reduce(function (promise, rule) {
    return promise.then(function (value) {
      if (value != null && value !== '') return value
      var next = rule($, url)
      if (next != null && next !== '') return next
      return null
    })
  }, Promise.resolve())
}
function scrapeMetadatum ( $ , url , rules ) { if ( ! Array . isArray ( rules ) ) rules = [ rules ] return rules . reduce ( function ( promise , rule ) { return promise . then ( function ( value ) { if ( value != null && value !== '' ) return value var next = rule ( $ , url ) if ( next != null && next !== '' ) return next return null } ) } , Promise . resolve ( ) ) }
Scrape the first non-null value returned by an array of `rules` functions for
a single property in the metadata result dictionary.

@param {Cheerio} $
@param {String} url
@param {Array or Function} rules
@return {Promise} value
Scrape the first non - null value returned by an array of rules functions for a single property in the metadata result dictionary .