lib/command/set.js
function sinter(/* key-1, key-N, req*/) {
  var args = slice.call(arguments, 0)
    , req = typeof args[args.length-1] === 'object' ? args.pop() : null
    , set = new Set()
    , list
    , src
    , i;

  for(i = 0;i < args.length;i++) {
    src = this.getKey(args[i], req);
    if(src === undefined) return [];
    set.sadd(src.data);
  }

  list = set.data.slice(0);

  function filter(member) {
    for(i = 0;i < args.length;i++) {
      src = this.getKey(args[i]);
      if(!src.sismember(member)) return false;
    }
    return true;
  }

  list = list.filter(filter.bind(this));

  return list;
}
function sinter(/* key-1, key-N, req*/) {
  var args = slice.call(arguments, 0)
    , req = typeof args[args.length-1] === 'object' ? args.pop() : null
    , set = new Set()
    , list
    , src
    , i;

  for(i = 0;i < args.length;i++) {
    src = this.getKey(args[i], req);
    if(src === undefined) return [];
    set.sadd(src.data);
  }

  list = set.data.slice(0);

  function filter(member) {
    for(i = 0;i < args.length;i++) {
      src = this.getKey(args[i]);
      if(!src.sismember(member)) return false;
    }
    return true;
  }

  list = list.filter(filter.bind(this));

  return list;
}
function sinter ( /* key-1, key-N, req*/ ) { var args = slice . call ( arguments , 0 ) , req = typeof args [ args . length - 1 ] === 'object' ? args . pop ( ) : null , set = new Set ( ) , list , src , i ; for ( i = 0 ; i < args . length ; i ++ ) { src = this . getKey ( args [ i ] , req ) ; if ( src === undefined ) return [ ] ; set . sadd ( src . data ) ; } list = set . data . slice ( 0 ) ; function filter ( member ) { for ( i = 0 ; i < args . length ; i ++ ) { src = this . getKey ( args [ i ] ) ; if ( ! src . sismember ( member ) ) return false ; } return true ; } list = list . filter ( filter . bind ( this ) ) ; return list ; }
Returns the members of the set resulting from the intersection
of all the given sets.
Returns the members of the set resulting from the intersection of all the given sets .