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
Payloadextendsobject=object
Parameters
value: any
key: PropertyKey
callback: ResultCallback<any, { key: typeof key } & Payload>
payload?: Payload
Return type
value is Obj
Returns
Example usage
Last updated