hasProperty(user, null); // => { ok: false, error: Error('[objects.hasProperty] 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 specified property.
key: K
Returns Result<boolean, Error>
A Result object with either a boolean indicating whether the object has the specified property, or an Error object if the input parameters are invalid.
Checks if a plain JavaScript object has a specified property.
Example
Example
Handle invalid input parameters: