addon/constraints.js
function intersection(sets) {
  let source = sets[0];
  let rest = sets.slice(1);
  let keys = Object.keys(source);
  let keysLength = keys.length;
  let restLength = rest.length;
  let result = [];
  for (let keyIndex = 0; keyIndex < keysLength; keyIndex++) {
    let key = keys[keyIndex];
    let matched = true;
    for (let restIndex = 0; restIndex < restLength; restIndex++) {
      if (!rest[restIndex].hasOwnProperty(key)) {
        matched = false;
        break;
      }
    }
    if (matched) {
      result.push(source[key]);
    }
  }
  return result;
}
function intersection(sets) {
  let source = sets[0];
  let rest = sets.slice(1);
  let keys = Object.keys(source);
  let keysLength = keys.length;
  let restLength = rest.length;
  let result = [];
  for (let keyIndex = 0; keyIndex < keysLength; keyIndex++) {
    let key = keys[keyIndex];
    let matched = true;
    for (let restIndex = 0; restIndex < restLength; restIndex++) {
      if (!rest[restIndex].hasOwnProperty(key)) {
        matched = false;
        break;
      }
    }
    if (matched) {
      result.push(source[key]);
    }
  }
  return result;
}
function intersection ( sets ) { let source = sets [ 0 ] ; let rest = sets . slice ( 1 ) ; let keys = Object . keys ( source ) ; let keysLength = keys . length ; let restLength = rest . length ; let result = [ ] ; for ( let keyIndex = 0 ; keyIndex < keysLength ; keyIndex ++ ) { let key = keys [ keyIndex ] ; let matched = true ; for ( let restIndex = 0 ; restIndex < restLength ; restIndex ++ ) { if ( ! rest [ restIndex ] . hasOwnProperty ( key ) ) { matched = false ; break ; } } if ( matched ) { result . push ( source [ key ] ) ; } } return result ; }
Returns a list of property values from source whose keys also appear in all of the rest objects.
Returns a list of property values from source whose keys also appear in all of the rest objects .