src/methods/artoo.methods.scrape.js
function polymorphism(iterator, data, params, cb) {
    var h = artoo.helpers,
        i, d, p, c;

    if (h.isPlainObject(iterator) &&
        !h.isSelector(iterator) &&
        !h.isDocument(iterator) &&
        (iterator.iterator || iterator.data || iterator.params)) {
      d = iterator.data;
      p = h.isPlainObject(iterator.params) ? iterator.params : {};
      i = iterator.iterator;
    }
    else {
      d = data;
      p = h.isPlainObject(params) ? params : {};
      i = iterator;
    }

    // Default values
    d = d || 'text';

    c = typeof cb === 'function' ? cb :
          typeof params === 'function' ? params :
            p.done;

    return [i, d, p, c];
  }
function polymorphism(iterator, data, params, cb) {
    var h = artoo.helpers,
        i, d, p, c;

    if (h.isPlainObject(iterator) &&
        !h.isSelector(iterator) &&
        !h.isDocument(iterator) &&
        (iterator.iterator || iterator.data || iterator.params)) {
      d = iterator.data;
      p = h.isPlainObject(iterator.params) ? iterator.params : {};
      i = iterator.iterator;
    }
    else {
      d = data;
      p = h.isPlainObject(params) ? params : {};
      i = iterator;
    }

    // Default values
    d = d || 'text';

    c = typeof cb === 'function' ? cb :
          typeof params === 'function' ? params :
            p.done;

    return [i, d, p, c];
  }
function polymorphism ( iterator , data , params , cb ) { var h = artoo . helpers , i , d , p , c ; if ( h . isPlainObject ( iterator ) && ! h . isSelector ( iterator ) && ! h . isDocument ( iterator ) && ( iterator . iterator || iterator . data || iterator . params ) ) { d = iterator . data ; p = h . isPlainObject ( iterator . params ) ? iterator . params : { } ; i = iterator . iterator ; } else { d = data ; p = h . isPlainObject ( params ) ? params : { } ; i = iterator ; } // Default values d = d || 'text' ; c = typeof cb === 'function' ? cb : typeof params === 'function' ? params : p . done ; return [ i , d , p , c ] ; }
Function taking care of harsh polymorphism
Function taking care of harsh polymorphism