UNPKG

@n3okill/utils

Version:
16 lines 713 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.trimLeft = trimLeft; const escapeRegExp_1 = require("./escapeRegExp"); const toString_1 = require("./toString"); /** * Remove given characters from the left side of the string * @param s String to remove the characters from * @param chars The characters to remove if not defined removes empty spaces. * @returns Trimmed string */ function trimLeft(s, chars = []) { // eslint-disable-next-line security/detect-non-literal-regexp return (0, toString_1.toString)(s).replace(chars.length ? new RegExp(`^[${(0, escapeRegExp_1.escapeRegExp)(chars.join(""))}]+`, "g") : /^\s+/g, ""); } //# sourceMappingURL=trimLeft.js.map