lang/array.js
/**
		 * Performs a binary search to locate an item within an array.
		 *
		 * @param {*[]} a
		 * @param {*} key
		 * @param {Function} comparator
		 * @param {Number=} start
		 * @param {Number=} end
		 * @returns {*|null}
		 */
Performs a binary search to locate an item within an array.
Performs a binary search to locate an item within an array .
binarySearch(a, key, comparator, start, end) {
			assert.argumentIsArray(a, 'a');
			assert.argumentIsRequired(comparator, 'comparator', Function);
			assert.argumentIsOptional(start, 'start', Number);
			assert.argumentIsOptional(end, 'end', Number);
			if (a.length === 0) {
				return null;
			}
			return binarySearchForMatch(a, key, comparator, start || 0, end || a.length - 1);
		}
binarySearch ( a , key , comparator , start , end ) { assert . argumentIsArray ( a , 'a' ) ; assert . argumentIsRequired ( comparator , 'comparator' , Function ) ; assert . argumentIsOptional ( start , 'start' , Number ) ; assert . argumentIsOptional ( end , 'end' , Number ) ; if ( a . length === 0 ) { return null ; } return binarySearchForMatch ( a , key , comparator , start || 0 , end || a . length - 1 ) ; }
Performs a binary search to locate an item within an array.
Performs a binary search to locate an item within an array .