Converts tests to TypeScript (#300)

This commit is contained in:
Jaco Greeff
2019-02-14 10:48:08 +01:00
committed by GitHub
parent 2a14a8b553
commit 1e6eb2c283
158 changed files with 89 additions and 183 deletions
-1
View File
@@ -6,7 +6,6 @@ import BN from 'bn.js';
/**
* @name isBn
* @signature isBN (value: any): boolean
* @summary Tests for a `BN` object instance.
* @description
* Checks to see if the input object is an instance of `BN` (bn.js).
-1
View File
@@ -4,7 +4,6 @@
/**
* @name isBoolean
* @signature isBoolean (value: any): boolean
* @summary Tests for a boolean value.
* @description
* Checks to see if the input value is a JavaScript boolean.
-1
View File
@@ -6,7 +6,6 @@ import isInstanceOf from './instanceOf';
/**
* @name isBuffer
* @signature isBuffer (value: any): boolean
* @summary Tests for a `Buffer` object instance.
* @description
* Checks to see if the input object is an instance of `Buffer`.
-1
View File
@@ -6,7 +6,6 @@ import isInstanceOf from './instanceOf';
/**
* @name isError
* @signature isError (value: any): boolean
* @summary Tests for a `Error` object instance.
* @description
* Checks to see if the input object is an instance of `Error`.
-1
View File
@@ -4,7 +4,6 @@
/**
* @name isFunction
* @signature isFunction (value: any): boolean
* @summary Tests for a `function`.
* @description
* Checks to see if the input value is a JavaScript function.
@@ -19,7 +19,6 @@ describe('isHex', () => {
).toEqual(true);
});
it('returns true on hex values with String', () => {
expect(
isHex(new String(`0x${test}`))
-1
View File
@@ -8,7 +8,6 @@ const HEX_REGEX = /^0x[a-fA-F0-9]+$/;
/**
* @name isHex
* @signature isHex (value: any, bitLength: number = -1): boolean
* @summary Tests for a hex string.
* @description
* Checks to see if the input value is a `0x` prefixed hex string. Optionally (`bitLength` !== -1) checks to see if the bitLength is correct.
-1
View File
@@ -4,7 +4,6 @@
/**
* @name isInstanceOf
* @signature isInstanceOf (value: any, clazz: Class<any>): boolean
* @summary Tests for a instance of a class.
* @description
* Checks to see if the input value is an instance of the test class.
-1
View File
@@ -8,7 +8,6 @@ type IpTypes = 'v4' | 'v6';
/**
* @name isIp
* @signature isIp (value: string, type?: 'v4' | 'v6'): boolean
* @summary Tests if the value is a valid IP address
* @description
* Checks to see if the value is a valid IP address. Optionally check for either v4/v6
+1 -2
View File
@@ -4,7 +4,6 @@
/**
* @name isNull
* @signature isNull (value: any): boolean
* @summary Tests for a `null` values.
* @description
* Checks to see if the input value is `null`.
@@ -17,6 +16,6 @@
* console.log('isNull', isNull(null)); // => true
* ```
*/
export default function isNull (value: any): value is null {
export default function isNull (value?: any): value is null {
return value === null;
}
-1
View File
@@ -4,7 +4,6 @@
/**
* @name isNumber
* @signature isNumber (value: any): boolean
* @summary Tests for a JavaScript number.
* @description
* Checks to see if the input value is a valid number.
-1
View File
@@ -8,7 +8,6 @@ type ObjectIndexed = {
/**
* @name isObject
* @signature isObject (value: any): boolean
* @summary Tests for an `object`.
* @description
* Checks to see if the input value is a JavaScript object.
-1
View File
@@ -11,7 +11,6 @@ type Observable = {
/**
* @name isBObservable
* @signature isObservable (value: any): boolean
* @summary Tests for a `Observable` object instance.
* @description
* Checks to see if the input object is an instance of `BN` (bn.js).
-1
View File
@@ -4,7 +4,6 @@
/**
* @name isString
* @signature isString (value: any): boolean
* @summary Tests for a string.
* @description
* Checks to see if the input value is a JavaScript string.
+1 -2
View File
@@ -6,7 +6,6 @@ import isInstanceOf from './instanceOf';
/**
* @name isU8a
* @signature isU8a (value: any): boolean
* @summary Tests for a `Uint8Array` object instance.
* @description
* Checks to see if the input object is an instance of `Uint8Array`.
@@ -19,6 +18,6 @@ import isInstanceOf from './instanceOf';
* console.log('isU8a', isU8a([])); // => false
* ```
*/
export default function isU8a (value: any): value is Uint8Array {
export default function isU8a (value?: any): value is Uint8Array {
return isInstanceOf(value, Uint8Array);
}
+1 -2
View File
@@ -4,7 +4,6 @@
/**
* @name isUndefined
* @signature isUndefined (value: any): boolean
* @summary Tests for a `undefined` values.
* @description
* Checks to see if the input value is `undefined`.
@@ -17,6 +16,6 @@
* console.log('isUndefined', isUndefined(void(0))); // => true
* ```
*/
export default function isUndefined (value: any): value is undefined {
export default function isUndefined (value?: any): value is undefined {
return typeof value === 'undefined';
}