diff options
Diffstat (limited to 'deps/npm/node_modules/cli-table2/node_modules/lodash/string/trimLeft.js')
-rw-r--r-- | deps/npm/node_modules/cli-table2/node_modules/lodash/string/trimLeft.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/string/trimLeft.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/string/trimLeft.js new file mode 100644 index 0000000000..29299677a0 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/string/trimLeft.js @@ -0,0 +1,36 @@ +var baseToString = require('../internal/baseToString'), + charsLeftIndex = require('../internal/charsLeftIndex'), + isIterateeCall = require('../internal/isIterateeCall'), + trimmedLeftIndex = require('../internal/trimmedLeftIndex'); + +/** + * Removes leading whitespace or specified characters from `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to trim. + * @param {string} [chars=whitespace] The characters to trim. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {string} Returns the trimmed string. + * @example + * + * _.trimLeft(' abc '); + * // => 'abc ' + * + * _.trimLeft('-_-abc-_-', '_-'); + * // => 'abc-_-' + */ +function trimLeft(string, chars, guard) { + var value = string; + string = baseToString(string); + if (!string) { + return string; + } + if (guard ? isIterateeCall(value, chars, guard) : chars == null) { + return string.slice(trimmedLeftIndex(string)); + } + return string.slice(charsLeftIndex(string, (chars + ''))); +} + +module.exports = trimLeft; |