@lou.codes/predicates
Version:
🧐 Predicate util functions
19 lines (18 loc) • 557 B
TypeScript
/**
* Curried wrapper for the `in` operator. Given a `property` name and an
* `object`, returns `true` the object contains that property, `false`
* otherwise.
*
* @category Objects
* @example
* ```typescript
* const hasCircle = has("🟢");
*
* hasCircle({ "🟢": "🟩" }); // true
* hasCircle({ "🟩": "🟢" }); // false
* ```
* @returns Curried function with `property` in context.
*/
export declare const has: <Property extends PropertyKey>(
property: Property,
) => (object: unknown) => object is Readonly<Record<Property, unknown>>;