mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +00:00
Simplify charsLeftIndex and charsRightIndex.
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -384,11 +384,7 @@
|
||||
var index = -1,
|
||||
length = string.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (chars.indexOf(string.charAt(index)) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (++index < length && chars.indexOf(string.charAt(index)) > -1) { }
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -404,11 +400,7 @@
|
||||
function charsRightIndex(string, chars) {
|
||||
var index = string.length;
|
||||
|
||||
while (index--) {
|
||||
if (chars.indexOf(string.charAt(index)) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (index-- && chars.indexOf(string.charAt(index)) > -1) { }
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user