Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
variable findKey
import { findKey } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns the first key that satisfies the provided testing function. Otherwise undefined is returned.

Use Object.keys(obj) to get all the properties of the object, Array.prototype.find() to test the provided function for each key-value pair. The callback receives three arguments - the value, the key and the object.

type

(obj: any, fn: Function) => unknown