Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/registerable/dev_deps.ts>endsWith

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

Checks if a string ends with the provided substring.

Examples

Example 1

// Basic
endsWith('world', 'hello world') // true
endsWith('earth', 'hello world') // false

Example 2

// Curry
const endsWithHtml = endsWith('html')
endsWithHtml('index.html') // true

type

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