source: trip-planner-front/node_modules/lodash/trimStart.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[6a3a178]1var baseToString = require('./_baseToString'),
2 castSlice = require('./_castSlice'),
3 charsStartIndex = require('./_charsStartIndex'),
4 stringToArray = require('./_stringToArray'),
5 toString = require('./toString');
6
7/** Used to match leading whitespace. */
8var reTrimStart = /^\s+/;
9
10/**
11 * Removes leading whitespace or specified characters from `string`.
12 *
13 * @static
14 * @memberOf _
15 * @since 4.0.0
16 * @category String
17 * @param {string} [string=''] The string to trim.
18 * @param {string} [chars=whitespace] The characters to trim.
19 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
20 * @returns {string} Returns the trimmed string.
21 * @example
22 *
23 * _.trimStart(' abc ');
24 * // => 'abc '
25 *
26 * _.trimStart('-_-abc-_-', '_-');
27 * // => 'abc-_-'
28 */
29function trimStart(string, chars, guard) {
30 string = toString(string);
31 if (string && (guard || chars === undefined)) {
32 return string.replace(reTrimStart, '');
33 }
34 if (!string || !(chars = baseToString(chars))) {
35 return string;
36 }
37 var strSymbols = stringToArray(string),
38 start = charsStartIndex(strSymbols, stringToArray(chars));
39
40 return castSlice(strSymbols, start).join('');
41}
42
43module.exports = trimStart;
Note: See TracBrowser for help on using the repository browser.