Skip to main content
variable yesNo
import { yesNo } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns true if the string is y/yes or false if the string is n/no.

Use RegExp.test() to check if the string evaluates to y/yes or n/no. Omit the second argument, def to set the default answer as no.

type

(val: string, def?) => unknown