Add a method for check if item is in set
someone561 opened this issue · comments
Hello,
i need a method to check if a item is in a set. I did not find that method, for my project. I use:
SortedSet.prototype.isInSet = function (val) {
return this.findIterator(val).value() !== null );
};
I would be happy to see such a function in js-sorted-set.
I'll solve this straight away.
In the meantime, please change your code to:
return this.findIterator(val).value() != val;
Otherwise your function will break when there's a subsequent value: iterators point at the space between two values, not at a value in particular.
thanks
It would be great if you mark this with the 0.0.7 Tag as release in git, so I can get it with bower.
Whoops! Sorry about that -- tagged.