Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / trimStart.js
1 var charsStartIndex = require('./internal/charsStartIndex'),
2     stringToArray = require('./internal/stringToArray'),
3     toString = require('./toString');
4
5 /** Used to match leading and trailing whitespace. */
6 var reTrimStart = /^\s+/;
7
8 /**
9  * Removes leading whitespace or specified characters from `string`.
10  *
11  * @static
12  * @memberOf _
13  * @category String
14  * @param {string} [string=''] The string to trim.
15  * @param {string} [chars=whitespace] The characters to trim.
16  * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
17  * @returns {string} Returns the trimmed string.
18  * @example
19  *
20  * _.trimStart('  abc  ');
21  * // => 'abc  '
22  *
23  * _.trimStart('-_-abc-_-', '_-');
24  * // => 'abc-_-'
25  */
26 function trimStart(string, chars, guard) {
27   string = toString(string);
28   if (!string) {
29     return string;
30   }
31   if (guard || chars === undefined) {
32     return string.replace(reTrimStart, '');
33   }
34   chars = (chars + '');
35   if (!chars) {
36     return string;
37   }
38   var strSymbols = stringToArray(string);
39   return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join('');
40 }
41
42 module.exports = trimStart;