function NonNullSet(){
  Set.apply(this,arguments);
}

NonNullSet.prototype = inherit(Set.prototype);
NonNullSet.prototype.constructor = NonNullSet;

NonNullSet.prototype.add = function(){
  for(var i = 0;i < arguments.length;i++){
    if(arguments[i] == null){
      throw new Error("Can't add null or undefined to a NonNullSet");
    }
  }
  return Set.prototype.add.apply(this.arguments);
}

 

posted on 2015-12-20 17:31  GoGoChad  阅读(380)  评论(0编辑  收藏  举报