Skip to main content
Module

x/nameable/deps.ts>startsWith

Cross-check whether it can be used as a package name or domain name
Latest
variable startsWith
import { startsWith } from "https://deno.land/x/nameable@v1.1.0-beta.4/deps.ts";

Checks if a string starts with the provided substring.

Examples

Example 1

// Basic
startsWith('hello', 'hello world') // true
startsWith('good', 'hello world') // false

Example 2

// Curry
const startWithSlash = startsWith('/')
startWithSlash('/path/to') // true

type

<T extends string, U extends string | undefined = undefined>(val: T, target?: U) => StartsWith<U>