Skip to content

hasProp

hasProp(target, key)

Checks if target object has the specified key property with a non-null and non-undefined value.

ts
hasProp({ a: 1, b: null }, "a"); // true
hasProp({ a: 1, b: null }, "b"); // false
ts
pipe({ a: 1, b: null }, hasProp("a")); // true
pipe({ a: 1, b: null }, hasProp("b")); // false