File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 11// Function.
2- import { isClass } from './is-class.func' ;
3- import { isFunction } from './is-function.func' ;
4- import { isObject } from './is-object.func' ;
52import { resultCallback } from '../../lib/result-callback.func' ;
63// Interface.
74import { CallbackPayload } from '../../interface/callback-payload.interface' ;
85// Type.
96import { Constructor } from '../../type/constructor.type' ;
107import { ResultCallback } from '../../type/result-callback.type' ;
118/**
12- * Checks if any `value` is an `object` of a generic `Obj` type and an ` instance` of `Constructor` type .
9+ * Checks if any `value` is an `object` type, an instance of `Object` and an instance of the provided `constructor` .
1310 * @param value The `value` of any type to check against an instance of the provided `constructor`.
1411 * @param constructor A `class` or `function` that specifies the type of the `Constructor`.
1512 * @param callback A callback function of `ResultCallback` type with `payload` parameter of the default `CallbackPayload` shape and the
@@ -28,11 +25,11 @@ export const isInstance = <Obj, Payload extends object>(
2825 payload ?: Payload
2926) : value is Obj =>
3027 callback (
31- isObject < Obj > ( value )
32- ? isClass < Obj > ( constructor ) || isFunction ( constructor )
33- ? value instanceof constructor === true
34- : false
35- : false ,
28+ typeof value === 'object' &&
29+ value instanceof Object === true &&
30+ typeof constructor === 'function'
31+ ? value instanceof constructor === true
32+ : false ,
3633 {
3734 ...{
3835 name : isInstance . name ,
You can’t perform that action at this time.
0 commit comments