-
-
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.
feat(utils):
isBigInt64Array
, isBigUint64Array
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
e42c69d
commit 4dbd6cc
Showing
7 changed files
with
104 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @file Type Tests - isBigInt64Array | ||
* @module tutils/utils/tests/unit-d/isBigInt64Array | ||
*/ | ||
|
||
import type testSubject from '../is-big-int64-array' | ||
|
||
describe('unit-d:utils/isBigInt64Array', () => { | ||
it('should guard BigInt64Array', () => { | ||
expectTypeOf<typeof testSubject>().guards.toEqualTypeOf<BigInt64Array>() | ||
}) | ||
}) |
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,16 @@ | ||
/** | ||
* @file Unit Tests - isBigInt64Array | ||
* @module tutils/utils/tests/unit/isBigInt64Array | ||
*/ | ||
|
||
import testSubject from '../is-big-int64-array' | ||
|
||
describe('unit:utils/isBigInt64Array', () => { | ||
it('should return false if value is not BigInt64Array instance', () => { | ||
expect(testSubject(new BigUint64Array())).to.be.false | ||
}) | ||
|
||
it('should return true if value is BigInt64Array instance', () => { | ||
expect(testSubject(new BigInt64Array())).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,12 @@ | ||
/** | ||
* @file Type Tests - isBigUint64Array | ||
* @module tutils/utils/tests/unit-d/isBigUint64Array | ||
*/ | ||
|
||
import type testSubject from '../is-big-uint64-array' | ||
|
||
describe('unit-d:utils/isBigUint64Array', () => { | ||
it('should guard BigUint64Array', () => { | ||
expectTypeOf<typeof testSubject>().guards.toEqualTypeOf<BigUint64Array>() | ||
}) | ||
}) |
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,16 @@ | ||
/** | ||
* @file Unit Tests - isBigUint64Array | ||
* @module tutils/utils/tests/unit/isBigUint64Array | ||
*/ | ||
|
||
import testSubject from '../is-big-uint64-array' | ||
|
||
describe('unit:utils/isBigUint64Array', () => { | ||
it('should return false if value is not BigUint64Array instance', () => { | ||
expect(testSubject(new BigInt64Array())).to.be.false | ||
}) | ||
|
||
it('should return true if value is BigUint64Array instance', () => { | ||
expect(testSubject(new BigUint64Array())).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,23 @@ | ||
/** | ||
* @file Utilities - isBigInt64Array | ||
* @module tutils/utils/isBigInt64Array | ||
*/ | ||
|
||
import equal from './equal' | ||
import isObject from './is-object' | ||
|
||
/** | ||
* Checks if `value` is a {@linkcode BigInt64Array} instance. | ||
* | ||
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array | ||
* | ||
* @todo examples | ||
* | ||
* @param {unknown} value - Value to check | ||
* @return {value is BigInt64Array} `true` if `value` is an `BigInt64Array` | ||
*/ | ||
const isBigInt64Array = (value: unknown): value is BigInt64Array => { | ||
return isObject(value) && equal(value.constructor, BigInt64Array) | ||
} | ||
|
||
export default isBigInt64Array |
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,23 @@ | ||
/** | ||
* @file Utilities - isBigUint64Array | ||
* @module tutils/utils/isBigUint64Array | ||
*/ | ||
|
||
import equal from './equal' | ||
import isObject from './is-object' | ||
|
||
/** | ||
* Checks if `value` is a {@linkcode BigUint64Array} instance. | ||
* | ||
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array | ||
* | ||
* @todo examples | ||
* | ||
* @param {unknown} value - Value to check | ||
* @return {value is BigUint64Array} `true` if `value` is an `BigUint64Array` | ||
*/ | ||
const isBigUint64Array = (value: unknown): value is BigUint64Array => { | ||
return isObject(value) && equal(value.constructor, BigUint64Array) | ||
} | ||
|
||
export default isBigUint64Array |