Skip to content

Commit

Permalink
feat(isARelativeRangeObject): add relative-range distinguishing function
Browse files Browse the repository at this point in the history
  • Loading branch information
saxaathlete committed Mar 14, 2019
1 parent c7ed43a commit 218a5ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/relative-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ class RelativeRange {
toArray(format?: string = DAY_FORMAT): string[] {
return [this.start.format(format), this.end.format(format)];
}

isARelativeRangeObject(): boolean {
return true;
}
}

Object.keys(rangeSchema).forEach((attr) => {
Expand Down
4 changes: 4 additions & 0 deletions tests/relative-range.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ describe('RelativeRange', function () {
expect(this.range.length).to.be.a('number');
});

it('should be a relative range object', function () {
expect(this.range.isARelativeRangeObject()).to.equal(true);
});

describe('defaults', function () {
it('should have units 1', function () {
expect(this.range.units).to.equal(1);
Expand Down

0 comments on commit 218a5ae

Please sign in to comment.