diff --git a/.travis.yml b/.travis.yml
index f3fa8cd..d2442b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,3 @@
language: node_js
node_js:
- '10'
- - '8'
diff --git a/package.json b/package.json
index e34361a..cc9a373 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
},
"main": "dist",
"engines": {
- "node": ">=8"
+ "node": ">=10"
},
"scripts": {
"build": "del dist && tsc",
@@ -80,6 +80,11 @@
"extensions": [
"ts"
],
+ "globals": [
+ "BigInt",
+ "BigInt64Array",
+ "BigUint64Array"
+ ],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off"
}
diff --git a/source/index.ts b/source/index.ts
index a819a5d..c0038e5 100644
--- a/source/index.ts
+++ b/source/index.ts
@@ -1,11 +1,6 @@
-///
-///
+///
///
-// TODO: Use the `URL` global when targeting Node.js 10
-// eslint-disable-next-line @typescript-eslint/no-require-imports
-const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL;
-
export type Class = new (...args: any[]) => T;
export const enum TypeName {
@@ -14,6 +9,7 @@ export const enum TypeName {
undefined = 'undefined',
string = 'string',
number = 'number',
+ bigint = 'BigInt',
symbol = 'symbol',
Function = 'Function',
Generator = 'Generator',
@@ -39,6 +35,8 @@ export const enum TypeName {
Uint32Array = 'Uint32Array',
Float32Array = 'Float32Array',
Float64Array = 'Float64Array',
+ BigInt64Array = 'BigInt64Array',
+ BigUint64Array = 'BigUint64Array',
ArrayBuffer = 'ArrayBuffer',
SharedArrayBuffer = 'SharedArrayBuffer',
DataView = 'DataView',
@@ -77,6 +75,8 @@ function is(value: unknown): TypeName {
return TypeName.string;
case 'number':
return TypeName.number;
+ case 'bigint':
+ return TypeName.bigint;
case 'symbol':
return TypeName.symbol;
default:
@@ -115,6 +115,7 @@ const isObject = (value: unknown): value is object => typeof value === 'object';
is.undefined = isOfType('undefined');
is.string = isOfType('string');
is.number = isOfType('number');
+is.bigint = isOfType('bigint');
// eslint-disable-next-line @typescript-eslint/ban-types
is.function_ = isOfType('function');
@@ -175,6 +176,8 @@ is.int32Array = isObjectOfType(TypeName.Int32Array);
is.uint32Array = isObjectOfType(TypeName.Uint32Array);
is.float32Array = isObjectOfType(TypeName.Float32Array);
is.float64Array = isObjectOfType(TypeName.Float64Array);
+is.bigint64Array = isObjectOfType(TypeName.BigInt64Array);
+is.biguint64Array = isObjectOfType(TypeName.BigUint64Array);
is.arrayBuffer = isObjectOfType(TypeName.ArrayBuffer);
is.sharedArrayBuffer = isObjectOfType(TypeName.SharedArrayBuffer);
@@ -189,7 +192,7 @@ is.urlString = (value: unknown): value is string => {
}
try {
- new URLGlobal(value); // eslint-disable-line no-new
+ new URL(value); // eslint-disable-line no-new
return true;
} catch {
return false;
diff --git a/test/test.ts b/test/test.ts
index 363d647..69e47d9 100644
--- a/test/test.ts
+++ b/test/test.ts
@@ -2,7 +2,6 @@ import fs from 'fs';
import net from 'net';
import Stream from 'stream';
import util from 'util';
-import {URL} from 'url';
import tempy from 'tempy';
import test, {ExecutionContext} from 'ava';
import {JSDOM} from 'jsdom';
@@ -69,6 +68,17 @@ const types = new Map([
],
typename: TypeName.number
}],
+ ['bigint', {
+ is: is.bigint,
+ fixtures: [
+ 1n,
+ 0n,
+ -0n,
+ // eslint-disable-next-line new-cap
+ BigInt('1234')
+ ],
+ typename: TypeName.bigint
+ }],
['boolean', {
is: is.boolean,
fixtures: [
@@ -311,6 +321,20 @@ const types = new Map([
],
typename: TypeName.Float64Array
}],
+ ['bigint64Array', {
+ is: is.bigint64Array,
+ fixtures: [
+ new BigInt64Array()
+ ],
+ typename: TypeName.BigInt64Array
+ }],
+ ['biguint64Array', {
+ is: is.biguint64Array,
+ fixtures: [
+ new BigUint64Array()
+ ],
+ typename: TypeName.BigUint64Array
+ }],
['arrayBuffer', {
is: is.arrayBuffer,
fixtures: [
diff --git a/tsconfig.json b/tsconfig.json
index c76ee17..8383a7c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,10 +2,10 @@
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
"outDir": "dist",
- "target": "es2017",
+ "target": "esnext",
"lib": [
"es2017",
- "esnext.asynciterable",
+ "esnext",
"dom"
]
},