2026-05-31 13:54:31 +02:00

25 lines
824 B
JavaScript

import { trimStart as trimStart$1 } from "../../string/trimStart.mjs";
//#region src/compat/string/trimStart.ts
/**
* Removes leading whitespace or specified characters from a string.
*
* @param {string} str - The string from which leading characters will be trimmed.
* @param {string | number} chars - The character(s) to remove from the start of the string.
* @param {object} guard - Enables use as an iteratee for methods like `map`.
* @returns {string} Returns the trimmed string.
*
* @example
* trimStart(' abc ');
* // => 'abc '
*
* trimStart('-_-abc-_-', '_-');
* // => 'abc-_-'
*/
function trimStart(str, chars, guard) {
if (str == null) return "";
if (guard != null || chars == null) return str.toString().trimStart();
return trimStart$1(str, chars.toString().split(""));
}
//#endregion
export { trimStart };