Skip to content

assertStringStartsWith

Assert that a string starts with a given prefix, with type narrowing.

import { assertStringStartsWith } from "@kensio/smartass";
const url: string = "https://example.com";
assertStringStartsWith(url, "https://");
// url is now narrowed to a string starting with "https://"

Source file: src/assert/string-starts-with/string-starts-with.assert.ts