Cleanup isWhitespace use.

This commit is contained in:
John-David Dalton
2014-07-19 21:42:38 -07:00
parent 60f57f9e4b
commit 4f4a7409f6

View File

@@ -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 * @private
* @param {number} c The charCode to inspect. * @param {number} c The charCode to inspect.
@@ -552,11 +553,7 @@
var index = -1, var index = -1,
length = string.length; length = string.length;
while (++index < length) { while (++index < length && isWhitespace(string.charCodeAt(index))) { }
if (!isWhitespace(string.charCodeAt(index))) {
break;
}
}
return index; return index;
} }
@@ -571,11 +568,7 @@
function trimmedRightIndex(string) { function trimmedRightIndex(string) {
var index = string.length; var index = string.length;
while (index--) { while (index-- && isWhitespace(string.charCodeAt(index))) { }
if (!isWhitespace(string.charCodeAt(index))) {
break;
}
}
return index; return index;
} }