mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Bump to v3.0.0.
This commit is contained in:
39
lodash._trimmedleftindex/index.js
Normal file
39
lodash._trimmedleftindex/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
|
||||
* character code is whitespace.
|
||||
*
|
||||
* @private
|
||||
* @param {number} charCode The character code to inspect.
|
||||
* @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
|
||||
*/
|
||||
function isSpace(charCode) {
|
||||
return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
|
||||
(charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
|
||||
* character of `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {number} Returns the index of the first non-whitespace character.
|
||||
*/
|
||||
function trimmedLeftIndex(string) {
|
||||
var index = -1,
|
||||
length = string.length;
|
||||
|
||||
while (++index < length && isSpace(string.charCodeAt(index))) {}
|
||||
return index;
|
||||
}
|
||||
|
||||
module.exports = trimmedLeftIndex;
|
||||
Reference in New Issue
Block a user