Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/registerable/deps.ts>props

Check if it can be registered as a package name or domain name
Latest
variable props
import { props } from "https://deno.land/x/registerable@v1.3.2/deps.ts";

Returns a function that when supplied an object returns the indicated property of that object, if it exists.

Examples

Example 1

props('x', { x: 'hello' }) // 'hello'
props(1, { 1: 100 }) // 100
props('x', {}) // undefined

type

<T extends string | number, U extends Record<PropertyKey, unknown>>(val: T, obj: U) => U extends Record<T, unknown> ? U[T] : undefined