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

Retrieve a set of properties indicated by the given selectors from an object.

Use String.prototype.replace() to replace square brackets with dots, String.prototype.split('.') to split each selector, Array.prototype.filter() to remove empty values and Array.prototype.reduce() to get the value indicated by it.

type

(
from: any,
selector: string,
defaultValue?: any,
) => unknown