-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
4a6f2bc
commit 2612779
Showing
10 changed files
with
115 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
* @module fixtures/FLOAT | ||
*/ | ||
|
||
import INT from './int' | ||
import INT from './integer' | ||
|
||
export default INT / 100 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @file Fixtures - INTEGER | ||
* @module fixtures/INTEGER | ||
*/ | ||
|
||
export default 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Type Tests - isFloat | ||
* @module tutils/guards/tests/unit-d/isFloat | ||
*/ | ||
|
||
import type { Float } from '#src/types' | ||
import type testSubject from '../is-float' | ||
|
||
describe('unit-d:guards/isFloat', () => { | ||
it('should guard Float', () => { | ||
expectTypeOf<typeof testSubject>().guards.toEqualTypeOf<Float>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @file Unit Tests - isFloat | ||
* @module tutils/utils/tests/unit/isFloat | ||
*/ | ||
|
||
import FLOAT from '#fixtures/float' | ||
import INT from '#fixtures/integer' | ||
import testSubject from '../is-float' | ||
|
||
describe('unit:utils/isFloat', () => { | ||
it('should return false if value is not a float', () => { | ||
expect(testSubject(INT)).to.be.false | ||
}) | ||
|
||
it('should return true if value is a float', () => { | ||
expect(testSubject(FLOAT)).to.be.true | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Type Tests - isInteger | ||
* @module tutils/guards/tests/unit-d/isInteger | ||
*/ | ||
|
||
import type { Integer } from '#src/types' | ||
import type testSubject from '../is-integer' | ||
|
||
describe('unit-d:guards/isInteger', () => { | ||
it('should guard Integer', () => { | ||
expectTypeOf<typeof testSubject>().guards.toEqualTypeOf<Integer>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @file Unit Tests - isInteger | ||
* @module tutils/utils/tests/unit/isInteger | ||
*/ | ||
|
||
import FLOAT from '#fixtures/float' | ||
import INTEGER from '#fixtures/integer' | ||
import testSubject from '../is-integer' | ||
|
||
describe('unit:utils/isInteger', () => { | ||
it('should return false if value is not an integer', () => { | ||
expect(testSubject(FLOAT)).to.be.false | ||
}) | ||
|
||
it('should return true if value is an integer', () => { | ||
expect(testSubject(INTEGER)).to.be.true | ||
expect(testSubject(INTEGER * 0)).to.be.true | ||
expect(testSubject(INTEGER * -1)).to.be.true | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @file Utilities - isFloat | ||
* @module tutils/utils/isFloat | ||
*/ | ||
|
||
import type { Float } from '#src/types' | ||
import isNumber from './is-number' | ||
|
||
/** | ||
* Checks if `value` is a floating point number. | ||
* | ||
* @see {@linkcode Float} | ||
* | ||
* @param {unknown} value - Value to check | ||
* @return {value is Float} `true` if `value` is a float | ||
*/ | ||
function isFloat(value: unknown): value is Float { | ||
return isNumber(value) && value % 1 !== 0 | ||
} | ||
|
||
export default isFloat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @file Utilities - isInteger | ||
* @module tutils/utils/isInteger | ||
*/ | ||
|
||
import type { Integer } from '#src/types' | ||
import isNumber from './is-number' | ||
|
||
/** | ||
* Checks if `value` is an integer. | ||
* | ||
* @see {@linkcode Integer} | ||
* | ||
* @param {unknown} value - Value to check | ||
* @return {value is Integer} `true` if `value` is an integer | ||
*/ | ||
function isInteger(value: unknown): value is Integer { | ||
return isNumber(value) && value % 1 === 0 | ||
} | ||
|
||
export default isInteger |