mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Bump to v3.0.0.
This commit is contained in:
18
internal/trimmedRightIndex.js
Normal file
18
internal/trimmedRightIndex.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import isSpace from './isSpace';
|
||||
|
||||
/**
|
||||
* Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
|
||||
* character of `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {number} Returns the index of the last non-whitespace character.
|
||||
*/
|
||||
function trimmedRightIndex(string) {
|
||||
var index = string.length;
|
||||
|
||||
while (index-- && isSpace(string.charCodeAt(index))) {}
|
||||
return index;
|
||||
}
|
||||
|
||||
export default trimmedRightIndex;
|
||||
Reference in New Issue
Block a user