summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/strings/ltrim.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/strings/ltrim.js')
-rw-r--r--node_modules/locutus/php/strings/ltrim.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/locutus/php/strings/ltrim.js b/node_modules/locutus/php/strings/ltrim.js
new file mode 100644
index 0000000..f47b69c
--- /dev/null
+++ b/node_modules/locutus/php/strings/ltrim.js
@@ -0,0 +1,18 @@
+'use strict';
+
+module.exports = function ltrim(str, charlist) {
+ // discuss at: http://locutus.io/php/ltrim/
+ // original by: Kevin van Zonneveld (http://kvz.io)
+ // input by: Erkekjetter
+ // improved by: Kevin van Zonneveld (http://kvz.io)
+ // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)
+ // example 1: ltrim(' Kevin van Zonneveld ')
+ // returns 1: 'Kevin van Zonneveld '
+
+ charlist = !charlist ? ' \\s\xA0' : (charlist + '').replace(/([[\]().?/*{}+$^:])/g, '$1');
+
+ var re = new RegExp('^[' + charlist + ']+', 'g');
+
+ return (str + '').replace(re, '');
+};
+//# sourceMappingURL=ltrim.js.map \ No newline at end of file