blob: 9a9f541a95606ec14facd208cd760074867cc3a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Generated by CoffeeScript 1.10.0
(function() {
var binary_search;
binary_search = function(items, value) {
var pivot, start, stop;
start = 0;
stop = items.length - 1;
pivot = Math.floor((start + stop) / 2);
while (items[pivot] !== value && start < stop) {
if (value < items[pivot]) {
stop = pivot - 1;
}
if (value > items[pivot]) {
start = pivot + 1;
}
pivot = Math.floor((stop + start) / 2);
}
if (items[pivot] === value) {
return pivot;
} else {
return -1;
}
};
self.onmessage = function(event) {
console.log("EUTA");
var data;
data = event.data;
return binary_search(data.items, data.value);
};
}).call(this);
//# sourceMappingURL=code_worker-source-map.js.map
|