predictype

predictype v0.8.1


predictype / predicates/objects / objectKeyMembership

Function: objectKeyMembership()

objectKeyMembership(source, oper, keys): boolean

Defined in: predicates/objects/objectKeyMembership.ts:18

Checks if a key is (or is not) in a list of possible keys using the specified operation.

Parameters

source

object

The object to check.

oper

ObjectKeyMembershipOper

The membership operation to perform (e.g. ‘key_in’, ‘key_not_in’).

keys

(string | symbol)[]

The array of possible keys.

Returns

boolean

True if the membership check is valid according to the operator, otherwise false.

Throws

If the operation is not recognized or keys is missing.

Remarks

Supported Operators: