Skip to content

Commit

Permalink
Making isProperX() methods in Set more efficient by doing the size ch…
Browse files Browse the repository at this point in the history
…eck first.
  • Loading branch information
jcoglan committed Aug 8, 2008
1 parent ece1160 commit d9e0a9d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions source/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,11 @@ JS.Set = new JS.Class({
},

isProperSubset: function(other) {
return this.isSubset(other) &&
this._members.length < other._members.length;
return this._members.length < other._members.length && this.isSubset(other);
},

isProperSuperset: function() {
return this.isSuperset(other) &&
this._members.length > other._members.length;
return this._members.length > other._members.length && this.isSuperset(other);
},

isSubset: function(other) {
Expand Down

0 comments on commit d9e0a9d

Please sign in to comment.