11 lines
424 B
JavaScript
11 lines
424 B
JavaScript
![]() |
var makeString = require('./helper/makeString');
|
||
|
var defaultToWhiteSpace = require('./helper/defaultToWhiteSpace');
|
||
|
var nativeTrimLeft = String.prototype.trimLeft;
|
||
|
|
||
|
module.exports = function ltrim(str, characters) {
|
||
|
str = makeString(str);
|
||
|
if (!characters && nativeTrimLeft) return nativeTrimLeft.call(str);
|
||
|
characters = defaultToWhiteSpace(characters);
|
||
|
return str.replace(new RegExp('^' + characters + '+'), '');
|
||
|
};
|