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:
20
internal/charsRightIndex.js
Normal file
20
internal/charsRightIndex.js
Normal file
@@ -0,0 +1,20 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Used by `_.trim` and `_.trimRight` to get the index of the last character
|
||||
* of `string` that is not found in `chars`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @param {string} chars The characters to find.
|
||||
* @returns {number} Returns the index of the last character not found in `chars`.
|
||||
*/
|
||||
function charsRightIndex(string, chars) {
|
||||
var index = string.length;
|
||||
|
||||
while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
|
||||
return index;
|
||||
}
|
||||
|
||||
return charsRightIndex;
|
||||
});
|
||||
Reference in New Issue
Block a user