@monstermann/fn
Version:
A utility library for TypeScript.
24 lines (22 loc) • 511 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/string/startsWith.ts
/**
* `startsWith(target, source)`
*
* Checks if `target` string starts with `source` string.
*
* ```ts
* startsWith("hello world", "hello"); // true
* startsWith("hello world", "world"); // false
* ```
*
* ```ts
* pipe("hello world", startsWith("hello")); // true
* pipe("hello world", startsWith("world")); // false
* ```
*/
const startsWith = dfdlT((a, b) => {
return a.startsWith(b);
}, 2);
//#endregion
export { startsWith };