08aeb13607f01bec440238b62fdec3d498dce46d
[platform/framework/web/crosswalk-tizen.git] /
1 var isSpace = require('./isSpace');
2
3 /**
4  * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
5  * character of `string`.
6  *
7  * @private
8  * @param {string} string The string to inspect.
9  * @returns {number} Returns the index of the first non-whitespace character.
10  */
11 function trimmedLeftIndex(string) {
12   var index = -1,
13       length = string.length;
14
15   while (++index < length && isSpace(string.charCodeAt(index))) {}
16   return index;
17 }
18
19 module.exports = trimmedLeftIndex;