@azizbecha/strkit
Version:
strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.
18 lines • 580 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = startsWith;
/**
* Checks if a string starts with the specified prefix.
*
* @param str - The string to check.
* @param prefix - The prefix to check for.
* @returns A boolean indicating whether the string starts with the specified prefix.
*
* @example
* startsWith("hello world", "hello"); // Output: true
* startsWith("hello world", "world"); // Output: false
*/
function startsWith(str, prefix) {
return str.indexOf(prefix) === 0;
}
//# sourceMappingURL=startsWith.js.map