Add some type hints in ol.array
This commit is contained in:
+9
-3
@@ -10,9 +10,15 @@ goog.require('goog.asserts');
|
|||||||
* @return {number} Index.
|
* @return {number} Index.
|
||||||
*/
|
*/
|
||||||
ol.array.binaryFindNearest = function(arr, target) {
|
ol.array.binaryFindNearest = function(arr, target) {
|
||||||
var index = goog.array.binarySearch(arr, target, function(a, b) {
|
var index = goog.array.binarySearch(arr, target,
|
||||||
return b - a;
|
/**
|
||||||
});
|
* @param {number} a A.
|
||||||
|
* @param {number} b B.
|
||||||
|
* @return {number} b minus a.
|
||||||
|
*/
|
||||||
|
function(a, b) {
|
||||||
|
return b - a;
|
||||||
|
});
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
return index;
|
return index;
|
||||||
} else if (index == -1) {
|
} else if (index == -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user