anorgatarrak-wordpress-theme/node_modules/underscore.string/ltrim.js

11 lines
424 B
JavaScript
Raw Normal View History

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 + '+'), '');
};