Skip to main content
Module

x/registerable/deps.ts>validateDenoLand

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

Validation for nest.land package name

Examples

Example 1

validateDenoLand('is_valid') // [ true, "" ]
validateDenoLand('is-valid') // [ false, "Name contains only the characters a-z, 0-9 and _" ]

Example 2

// checkAll
validateDenoLand(" Abc", true); // [ false, ["Name cannot contain leading or trailing spaces", "Name contains only the characters a-z, 0-9 and _" ]]

type

<T extends boolean = false>(val: unknown, checkAll?: T) => T extends true ? ResultMsgs : ResultMsg