misc: Requested changes
This commit is contained in:
parent
7b1ddeb238
commit
6ce169cf82
2 changed files with 67 additions and 46 deletions
110
test/test.ts
110
test/test.ts
|
|
@ -68,17 +68,18 @@ const types = new Map<string, Test>([
|
||||||
],
|
],
|
||||||
typename: TypeName.number
|
typename: TypeName.number
|
||||||
}],
|
}],
|
||||||
['bigint', {
|
// TODO: Nodejs 10 only
|
||||||
is: is.bigint,
|
// ['bigint', {
|
||||||
fixtures: [
|
// is: is.bigint,
|
||||||
1n,
|
// fixtures: [
|
||||||
0n,
|
// 1n,
|
||||||
-0n,
|
// 0n,
|
||||||
// eslint-disable-next-line new-cap
|
// -0n,
|
||||||
BigInt('1234')
|
// // eslint-disable-next-line new-cap
|
||||||
],
|
// BigInt('1234')
|
||||||
typename: TypeName.bigint
|
// ],
|
||||||
}],
|
// typename: TypeName.bigint
|
||||||
|
// }],
|
||||||
['boolean', {
|
['boolean', {
|
||||||
is: is.boolean,
|
is: is.boolean,
|
||||||
fixtures: [
|
fixtures: [
|
||||||
|
|
@ -321,20 +322,21 @@ const types = new Map<string, Test>([
|
||||||
],
|
],
|
||||||
typename: TypeName.Float64Array
|
typename: TypeName.Float64Array
|
||||||
}],
|
}],
|
||||||
['bigint64Array', {
|
// TODO: Nodejs 10 only
|
||||||
is: is.bigint64Array,
|
// ['bigint64Array', {
|
||||||
fixtures: [
|
// is: is.bigint64Array,
|
||||||
new BigInt64Array()
|
// fixtures: [
|
||||||
],
|
// new BigInt64Array()
|
||||||
typename: TypeName.BigInt64Array
|
// ],
|
||||||
}],
|
// typename: TypeName.BigInt64Array
|
||||||
['biguint64Array', {
|
// }],
|
||||||
is: is.biguint64Array,
|
// ['biguint64Array', {
|
||||||
fixtures: [
|
// is: is.biguint64Array,
|
||||||
new BigUint64Array()
|
// fixtures: [
|
||||||
],
|
// new BigUint64Array()
|
||||||
typename: TypeName.BigUint64Array
|
// ],
|
||||||
}],
|
// typename: TypeName.BigUint64Array
|
||||||
|
// }],
|
||||||
['arrayBuffer', {
|
['arrayBuffer', {
|
||||||
is: is.arrayBuffer,
|
is: is.arrayBuffer,
|
||||||
fixtures: [
|
fixtures: [
|
||||||
|
|
@ -492,9 +494,10 @@ test('is.number', t => {
|
||||||
testType(t, 'number', ['nan', 'integer', 'safeInteger', 'infinite']);
|
testType(t, 'number', ['nan', 'integer', 'safeInteger', 'infinite']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.bigint', t => {
|
// TODO: Nodejs 10 only
|
||||||
testType(t, 'bigint');
|
// test('is.bigint', t => {
|
||||||
});
|
// testType(t, 'bigint');
|
||||||
|
// });
|
||||||
|
|
||||||
test('is.boolean', t => {
|
test('is.boolean', t => {
|
||||||
testType(t, 'boolean');
|
testType(t, 'boolean');
|
||||||
|
|
@ -624,13 +627,14 @@ test('is.float64Array', t => {
|
||||||
testType(t, 'float64Array');
|
testType(t, 'float64Array');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.bigint64Array', t => {
|
// TODO: Nodejs 10 only
|
||||||
testType(t, 'bigint64Array');
|
// test('is.bigint64Array', t => {
|
||||||
});
|
// testType(t, 'bigint64Array');
|
||||||
|
// });
|
||||||
|
|
||||||
test('is.biguint64Array', t => {
|
// test('is.biguint64Array', t => {
|
||||||
testType(t, 'biguint64Array');
|
// testType(t, 'biguint64Array');
|
||||||
});
|
// });
|
||||||
|
|
||||||
test('is.arrayBuffer', t => {
|
test('is.arrayBuffer', t => {
|
||||||
testType(t, 'arrayBuffer');
|
testType(t, 'arrayBuffer');
|
||||||
|
|
@ -675,21 +679,29 @@ test('is.truthy', t => {
|
||||||
t.true(is.truthy(Symbol('🦄')));
|
t.true(is.truthy(Symbol('🦄')));
|
||||||
t.true(is.truthy(true));
|
t.true(is.truthy(true));
|
||||||
t.true(is.truthy(1));
|
t.true(is.truthy(1));
|
||||||
t.true(is.truthy(1n));
|
|
||||||
// eslint-disable-next-line new-cap
|
// TODO: Nodejs 10 only
|
||||||
t.true(is.truthy(BigInt(1)));
|
// if (isNode10orHigher) {
|
||||||
|
// t.true(is.truthy(1n));
|
||||||
|
// // eslint-disable-next-line new-cap
|
||||||
|
// t.true(is.truthy(BigInt(1)));
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.falsy', t => {
|
test('is.falsy', t => {
|
||||||
t.true(is.falsy(false));
|
t.true(is.falsy(false));
|
||||||
t.true(is.falsy(0));
|
t.true(is.falsy(0));
|
||||||
t.true(is.falsy(0n));
|
|
||||||
t.true(is.falsy(''));
|
t.true(is.falsy(''));
|
||||||
t.true(is.falsy(null));
|
t.true(is.falsy(null));
|
||||||
t.true(is.falsy(undefined));
|
t.true(is.falsy(undefined));
|
||||||
t.true(is.falsy(NaN));
|
t.true(is.falsy(NaN));
|
||||||
// eslint-disable-next-line new-cap
|
|
||||||
t.true(is.falsy(BigInt(0)));
|
// TODO: Nodejs 10 only
|
||||||
|
// if (isNode10orHigher) {
|
||||||
|
// t.true(is.falsy(0n));
|
||||||
|
// // eslint-disable-next-line new-cap
|
||||||
|
// t.true(is.falsy(BigInt(0)));
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.nan', t => {
|
test('is.nan', t => {
|
||||||
|
|
@ -706,7 +718,6 @@ test('is.primitive', t => {
|
||||||
null,
|
null,
|
||||||
'🦄',
|
'🦄',
|
||||||
6,
|
6,
|
||||||
6n,
|
|
||||||
Infinity,
|
Infinity,
|
||||||
-Infinity,
|
-Infinity,
|
||||||
true,
|
true,
|
||||||
|
|
@ -714,6 +725,11 @@ test('is.primitive', t => {
|
||||||
Symbol('🦄')
|
Symbol('🦄')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// TODO: Nodejs 10 only
|
||||||
|
// if (isNode10orHigher) {
|
||||||
|
// primitives.push(6n);
|
||||||
|
// }
|
||||||
|
|
||||||
for (const el of primitives) {
|
for (const el of primitives) {
|
||||||
t.true(is.primitive(el));
|
t.true(is.primitive(el));
|
||||||
}
|
}
|
||||||
|
|
@ -783,11 +799,17 @@ test('is.typedArray', t => {
|
||||||
new Int32Array(),
|
new Int32Array(),
|
||||||
new Uint32Array(),
|
new Uint32Array(),
|
||||||
new Float32Array(),
|
new Float32Array(),
|
||||||
new Float64Array(),
|
new Float64Array()
|
||||||
new BigInt64Array(),
|
|
||||||
new BigUint64Array()
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// TODO: Nodejs 10 only
|
||||||
|
// if (isNode10orHigher) {
|
||||||
|
// typedArrays.push(
|
||||||
|
// new BigInt64Array(),
|
||||||
|
// new BigUint64Array()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
for (const item of typedArrays) {
|
for (const item of typedArrays) {
|
||||||
t.true(is.typedArray(item));
|
t.true(is.typedArray(item));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@
|
||||||
"extends": "@sindresorhus/tsconfig",
|
"extends": "@sindresorhus/tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"target": "esnext",
|
"target": "es2017",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2017",
|
|
||||||
"esnext",
|
"esnext",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue