src/helpers.js
function compare(object, description) {
  let ok = true,
      k;

  // If we reached here via a recursive call, object may be undefined because
  // not all items in a collection will have the same deep nesting structure.
  if (!object)
    return false;

  for (k in description) {
    if (type.object(description[k])) {
      ok = ok && compare(object[k], description[k]);
    }
    else if (type.array(description[k])) {
      ok = ok && !!~description[k].indexOf(object[k]);
    }
    else {
      if (object[k] !== description[k])
        return false;
    }
  }

  return ok;
}
function compare(object, description) {
  let ok = true,
      k;

  // If we reached here via a recursive call, object may be undefined because
  // not all items in a collection will have the same deep nesting structure.
  if (!object)
    return false;

  for (k in description) {
    if (type.object(description[k])) {
      ok = ok && compare(object[k], description[k]);
    }
    else if (type.array(description[k])) {
      ok = ok && !!~description[k].indexOf(object[k]);
    }
    else {
      if (object[k] !== description[k])
        return false;
    }
  }

  return ok;
}
function compare ( object , description ) { let ok = true , k ; // If we reached here via a recursive call, object may be undefined because // not all items in a collection will have the same deep nesting structure. if ( ! object ) return false ; for ( k in description ) { if ( type . object ( description [ k ] ) ) { ok = ok && compare ( object [ k ] , description [ k ] ) ; } else if ( type . array ( description [ k ] ) ) { ok = ok && ! ! ~ description [ k ] . indexOf ( object [ k ] ) ; } else { if ( object [ k ] !== description [ k ] ) return false ; } } return ok ; }
Function comparing an object's properties to a given descriptive
object.

@param  {object} object      - The object to compare.
@param  {object} description - The description's mapping.
@return {boolean}            - Whether the object matches the description.
Function comparing an object s properties to a given descriptive object .