source: imaps-frontend/node_modules/is-bigint/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 737 bytes
Line 
1'use strict';
2
3var hasBigInts = require('has-bigints')();
4
5if (hasBigInts) {
6 var bigIntValueOf = BigInt.prototype.valueOf;
7 var tryBigInt = function tryBigIntObject(value) {
8 try {
9 bigIntValueOf.call(value);
10 return true;
11 } catch (e) {
12 }
13 return false;
14 };
15
16 module.exports = function isBigInt(value) {
17 if (
18 value === null
19 || typeof value === 'undefined'
20 || typeof value === 'boolean'
21 || typeof value === 'string'
22 || typeof value === 'number'
23 || typeof value === 'symbol'
24 || typeof value === 'function'
25 ) {
26 return false;
27 }
28 if (typeof value === 'bigint') {
29 return true;
30 }
31
32 return tryBigInt(value);
33 };
34} else {
35 module.exports = function isBigInt(value) {
36 return false && value;
37 };
38}
Note: See TracBrowser for help on using the repository browser.