Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
range: don't throw if lower < upper
Browse files Browse the repository at this point in the history
This is a naive library. Don't attempt any sort of sanity checking until
we can properly handle infinity.
  • Loading branch information
benesch committed Jul 28, 2014
1 parent 1bf75b4 commit 4c59abe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ function Range(lower, upper, bounds) {
return;
}

if (lower && upper && lower > upper) {
throw new Error("invalid range: lower bound greater than upper bound");
}

bounds = bounds || "[)";
if (VALID_BOUNDS.indexOf(bounds) === -1) {
throw new Error(util.format("invalid bounds: %s", bounds));
Expand Down
4 changes: 2 additions & 2 deletions test/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe("Range", function () {
range.should.be.an.instanceOf(Range);
});

it("should reject ranges where lower > upper", function () {
it("should not reject ranges where lower > upper", function () {
(function () {
Range(2, 1, "[]");
}).should.throw(/invalid range/);
}).should.not.throw();
});

it("should reject ranges with invalid string bounds", function () {
Expand Down

0 comments on commit 4c59abe

Please sign in to comment.