Skip to content

assertStringEndsWith

Assert that a string ends with a given suffix, with type narrowing.

import { assertStringEndsWith } from "@kensio/smartass";
const filename: string = "index.ts";
assertStringEndsWith(filename, ".ts");
// filename is now narrowed to a string ending with ".ts"

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