Checks if the given key is present in the object.

Type signature

(key: string) => (xs?: any) => any

Examples

hasKey("c")({ a: 1, b: 2, c: 3 });
// ⇒ true
Try in REPL

Questions

  • How to check if an object contains a given key?

TypeScript sourceJavaScript source