|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
844 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var hasBigInts = require('has-bigints')();
|
|---|
| 4 |
|
|---|
| 5 | if (hasBigInts) {
|
|---|
| 6 | var bigIntValueOf = BigInt.prototype.valueOf;
|
|---|
| 7 | /** @type {(value: object) => value is BigInt} */
|
|---|
| 8 | var tryBigInt = function tryBigIntObject(value) {
|
|---|
| 9 | try {
|
|---|
| 10 | bigIntValueOf.call(value);
|
|---|
| 11 | return true;
|
|---|
| 12 | } catch (e) {
|
|---|
| 13 | }
|
|---|
| 14 | return false;
|
|---|
| 15 | };
|
|---|
| 16 |
|
|---|
| 17 | /** @type {import('.')} */
|
|---|
| 18 | module.exports = function isBigInt(value) {
|
|---|
| 19 | if (
|
|---|
| 20 | value === null
|
|---|
| 21 | || typeof value === 'undefined'
|
|---|
| 22 | || typeof value === 'boolean'
|
|---|
| 23 | || typeof value === 'string'
|
|---|
| 24 | || typeof value === 'number'
|
|---|
| 25 | || typeof value === 'symbol'
|
|---|
| 26 | || typeof value === 'function'
|
|---|
| 27 | ) {
|
|---|
| 28 | return false;
|
|---|
| 29 | }
|
|---|
| 30 | if (typeof value === 'bigint') {
|
|---|
| 31 | return true;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | return tryBigInt(value);
|
|---|
| 35 | };
|
|---|
| 36 | } else {
|
|---|
| 37 | /** @type {import('.')} */
|
|---|
| 38 | module.exports = function isBigInt(value) {
|
|---|
| 39 | return false && value;
|
|---|
| 40 | };
|
|---|
| 41 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.