UNPKG

@lou.codes/predicates

Version:
16 lines (15 loc) 409 B
/** * Takes a `constructor` and checks if given `input` is an instance of it. * * @category Objects * @example * ```typescript * const instanceOfArray = instanceOf(Array) * * instanceOfArray([]); // true * instanceOfArray({}); // false * ``` * @returns Returns a curried function with `constructor` in context. */ export const isInstanceOf = constructor => input => input instanceof constructor;