hasProperties(user, null); // => { ok: false, error: Error('[objects.hasProperties] Expected an array of property keys') }
Type Parameters
T extends Record<string, any>
K extends PropertyKey
Parameters
obj: T
The object to check for the properties.
keys: K[]
Returns Result<boolean, Error>
A Result object with either a boolean value indicating whether the object has all
the specified properties or not, or an Error object if any of the inputs are invalid.
Checks if an object has all the specified properties.
Remarks
This function uses the hasProperty function to check if the object has each property specified in the
props
array.Example
Example
Handle invalid input parameters: