isObjectKey()
isObjectKey()
isObjectKey()const isObjectKey = <
Obj extends object,
Payload extends object = object
>(
value: any,
key: PropertyKey,
callback: ResultCallback<any, { key: typeof key } & Payload> = resultCallback,
payload?: Payload
): value is Obj =>
callback(
isObject(value) ? {}.hasOwnProperty.call(value, key) : false,
value,
{ ...payload, key } as any
);Generic type variables
Objextendsobject
ObjextendsobjectPayloadextendsobject=object
Payloadextendsobject=objectParameters
value: any
value: anykey: PropertyKey
key: PropertyKeycallback: ResultCallback<any, { key: typeof key } & Payload>
callback: ResultCallback<any, { key: typeof key } & Payload>payload?: Payload
payload?: PayloadReturn type
value is Obj
value is ObjReturns
Example usage
Last updated