mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 13:17:50 +00:00
Cleanup isWhitespace use.
This commit is contained in:
15
lodash.js
15
lodash.js
@@ -529,7 +529,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a charCode is whitespace.
|
||||
* Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a
|
||||
* charCode is whitespace.
|
||||
*
|
||||
* @private
|
||||
* @param {number} c The charCode to inspect.
|
||||
@@ -552,11 +553,7 @@
|
||||
var index = -1,
|
||||
length = string.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (!isWhitespace(string.charCodeAt(index))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (++index < length && isWhitespace(string.charCodeAt(index))) { }
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -571,11 +568,7 @@
|
||||
function trimmedRightIndex(string) {
|
||||
var index = string.length;
|
||||
|
||||
while (index--) {
|
||||
if (!isWhitespace(string.charCodeAt(index))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (index-- && isWhitespace(string.charCodeAt(index))) { }
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user