Skip to content

Commit d33fdfb

Browse files
chore(is): prettier code formatter on functions and update jsdoc
1 parent aced2ce commit d33fdfb

23 files changed

+224
-100
lines changed

src/is/lib/is-big-int.func.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import { ResultCallback } from '../../type/result-callback.type';
77
/**
88
* Checks if any `value` is a `bigint` type.
99
* @param value Any `value` to check.
10-
* @param callback `ResultCallback` function to handle result before returns.
10+
* @param callback A `ResultCallback` function to handle the result before returns.
1111
* @returns A `boolean` indicating whether or not the `value` is a `bigint`.
1212
*/
13-
export const isBigInt: IsBigInt = (value: any, callback: ResultCallback = resultCallback): value is bigint =>
13+
export const isBigInt: IsBigInt = (
14+
value: any,
15+
callback: ResultCallback = resultCallback
16+
): value is bigint =>
1417
callback(typeOf(value) === 'bigint' && typeof value === 'bigint', value);

src/is/lib/is-boolean-object.func.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ import { ResultCallback } from '../../type/result-callback.type';
66
/**
77
* Checks if any `value` is an `object` type and instance of `Boolean` and `Object`.
88
* @param value Any `value` to check.
9-
* @param callback `ResultCallback` function to handle result before returns.
9+
* @param callback A `ResultCallback` function to handle the result before returns.
1010
* @returns A `boolean` indicating whether or not the `value` is a `Boolean` instance.
1111
*/
12-
export const isBooleanObject: IsBooleanObject = (value: any, callback: ResultCallback = resultCallback): value is Boolean =>
13-
callback(typeof value === 'object' && value instanceof Boolean === true && value instanceof Object === true, value);
12+
export const isBooleanObject: IsBooleanObject = (
13+
value: any,
14+
callback: ResultCallback = resultCallback
15+
// tslint:disable-next-line: ban-types
16+
): value is Boolean =>
17+
callback(
18+
typeof value === 'object' &&
19+
value instanceof Boolean === true &&
20+
value instanceof Object === true,
21+
value
22+
);

src/is/lib/is-boolean-type.func.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ import { ResultCallback } from '../../type/result-callback.type';
66
/**
77
* Checks if any `value` is a `boolean` type not an instance of `Boolean` and `Object`, and equal to `true` or `false`.
88
* @param value Any `value` to check.
9-
* @param callback `ResultCallback` function to handle result before returns.
9+
* @param callback A `ResultCallback` function to handle the result before returns.
1010
* @returns A `boolean` indicating whether or not the `value` is a `boolean` type.
1111
*/
12-
export const isBooleanType: IsBooleanType = (value: any, callback: ResultCallback = resultCallback): value is boolean =>
12+
export const isBooleanType: IsBooleanType = (
13+
value: any,
14+
callback: ResultCallback = resultCallback
15+
): value is boolean =>
1316
callback(
1417
value instanceof Boolean === false &&
1518
value instanceof Object === false &&

src/is/lib/is-boolean.func.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,12 @@ import { ResultCallback } from '../../type/result-callback.type';
1212
* @param callback `ResultCallback` function to handle result before returns.
1313
* @returns A `boolean` indicating whether or not the `value` is a `boolean` type or `Boolean` instance.
1414
*/
15-
export const isBoolean: IsBoolean = (value: any, callback: ResultCallback = resultCallback): value is boolean =>
16-
callback(typeOf(value) === 'boolean' && (isBooleanType(value) || isBooleanObject(value)), value);
15+
export const isBoolean: IsBoolean = (
16+
value: any,
17+
callback: ResultCallback = resultCallback
18+
): value is boolean =>
19+
callback(
20+
typeOf(value) === 'boolean' &&
21+
(isBooleanType(value) || isBooleanObject(value)),
22+
value
23+
);

src/is/lib/is-class.func.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ import { ResultCallback } from '../../type/result-callback.type';
77
/**
88
* Checks if any value is a `function` type, an instance of `Function` and `Object` as a generic `Class` type of `class`.
99
* @param value Any `value` to check.
10-
* @param callback A `ResultCallback` function to handle result before returns.
10+
* @param callback A `ResultCallback` function to handle the result before returns.
1111
* @returns A `boolean` indicating whether or not the `value` is a `class`.
1212
*/
13-
export const isClass: IsClass = <Class = Function>(value: any, callback: ResultCallback = resultCallback): value is Class =>
13+
// tslint:disable-next-line: ban-types
14+
export const isClass: IsClass = <Class = Function>(
15+
value: any,
16+
callback: ResultCallback = resultCallback
17+
): value is Class =>
1418
callback(
15-
(
16-
typeOf(value) === 'function' &&
19+
typeOf(value) === 'function' &&
1720
typeof value === 'function' &&
1821
value instanceof Function === true &&
1922
value instanceof Object === true
20-
) ?
21-
/class/.test(Function.prototype.toString.call(value).slice(0, 5))
23+
? /class/.test(Function.prototype.toString.call(value).slice(0, 5))
2224
: false,
2325
value
2426
);

src/is/lib/is-function.func.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ import { ResultCallback } from '../../type/result-callback.type';
88
/**
99
* Checks if any `value` is a `function` type, an instance of `Function` and `Object`.
1010
* @param value Any `value` to check.
11-
* @param callback `ResultCallback` function to handle result before returns.
11+
* @param callback A `ResultCallback` function to handle the result before returns.
1212
* @returns A `boolean` indicating whether or not the `value` is a `function`.
1313
*/
14-
export const isFunction: IsFunction = (value: any, callback: ResultCallback = resultCallback): value is Func =>
14+
export const isFunction: IsFunction = (
15+
value: any,
16+
callback: ResultCallback = resultCallback
17+
): value is Func =>
1518
callback(
16-
(
17-
typeOf(value) === 'function' &&
19+
typeOf(value) === 'function' &&
1820
typeof value === 'function' &&
1921
value instanceof Function === true &&
2022
value instanceof Object === true
21-
) ?
22-
/class/.test(Function.prototype.toString.call(value).slice(0, 5)) === false
23+
? /class/.test(Function.prototype.toString.call(value).slice(0, 5)) ===
24+
false
2325
: false,
2426
value
2527
);

src/is/lib/is-instance.func.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ import { ResultCallback } from '../../type/result-callback.type';
1414
* @param callback A `ResultCallback` function to handle the result before returns.
1515
* @returns A `boolean` indicating whether or not the `value` is an instance of a generic `Obj`.
1616
*/
17-
export const isInstance: IsInstance =
18-
<Obj>(value: any, constructor: Constructor<Obj>, callback: ResultCallback = resultCallback): value is Obj =>
19-
callback(
20-
isObject<Obj>(value) ?
21-
isClass<Obj>(constructor) || isFunction(constructor) ?
22-
value instanceof constructor === true
23-
: false
24-
: false,
25-
value
26-
);
17+
export const isInstance: IsInstance = <Obj>(
18+
value: any,
19+
constructor: Constructor<Obj>,
20+
callback: ResultCallback = resultCallback
21+
): value is Obj =>
22+
callback(
23+
isObject<Obj>(value)
24+
? isClass<Obj>(constructor) || isFunction(constructor)
25+
? value instanceof constructor === true
26+
: false
27+
: false,
28+
value
29+
);

src/is/lib/is-key.func.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ import { ResultCallback } from '../../type/result-callback.type';
1010
/**
1111
* Checks if any `value` is one of the `string`, `number`, or `symbol`.
1212
* @param value Any `value` to check.
13-
* @param callback `ResultCallback` function to handle result before returns.
13+
* @param callback A `ResultCallback` function to handle the result before returns.
1414
* @returns A `boolean` indicating whether or not the `value` is a `Key`.
1515
*/
16-
export const isKey: IsKey = (value: any, callback: ResultCallback = resultCallback): value is Key =>
17-
callback(isStringType(value) || isNumberType(value) || isSymbol(value), value);
16+
export const isKey: IsKey = (
17+
value: any,
18+
callback: ResultCallback = resultCallback
19+
): value is Key =>
20+
callback(
21+
isStringType(value) || isNumberType(value) || isSymbol(value),
22+
value
23+
);

src/is/lib/is-null.func.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ import { ResultCallback } from '../../type/result-callback.type';
77
/**
88
* Checks if any `value` is an `object` type and equal to `null`.
99
* @param value Any `value` to check.
10-
* @param callback `ResultCallback` function to handle result before returns.
10+
* @param callback A `ResultCallback` function to handle the result before returns.
1111
* @returns A `boolean` indicating whether or not the `value` is `null`.
1212
*/
13-
export const isNull: IsNull = (value: any, callback: ResultCallback = resultCallback): value is null =>
14-
callback(typeOf(value) === 'null' && typeof value === 'object' && value === null, value);
13+
export const isNull: IsNull = (
14+
value: any,
15+
callback: ResultCallback = resultCallback
16+
): value is null =>
17+
callback(
18+
typeOf(value) === 'null' && typeof value === 'object' && value === null,
19+
value
20+
);

src/is/lib/is-number-object.func.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ import { ResultCallback } from '../../type/result-callback.type';
66
/**
77
* Checks if any `value` is an `object` type and instance of `Number` and `Object`.
88
* @param value Any `value` to check.
9-
* @param callback `ResultCallback` function to handle result before returns.
9+
* @param callback A `ResultCallback` function to handle the result before returns.
1010
* @returns A `boolean` indicating whether or not the `value` is a `Number` instance.
1111
*/
12-
export const isNumberObject: IsNumberObject = (value: any, callback: ResultCallback = resultCallback): value is Number =>
13-
callback(typeof value === 'object' && value instanceof Number === true && value instanceof Object === true, value);
12+
export const isNumberObject: IsNumberObject = (
13+
value: any,
14+
callback: ResultCallback = resultCallback
15+
// tslint:disable-next-line: ban-types
16+
): value is Number =>
17+
callback(
18+
typeof value === 'object' &&
19+
value instanceof Number === true &&
20+
value instanceof Object === true,
21+
value
22+
);

0 commit comments

Comments
 (0)