OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 function makeContainerPosVisible(container, pos) { | 7 function makeContainerPosVisible(container, pos) { |
8 var height = container.offsetHeight; | 8 var height = container.offsetHeight; |
9 var margin = Math.floor(height / 4); | 9 var margin = Math.floor(height / 4); |
10 if (pos < container.scrollTop + margin) { | 10 if (pos < container.scrollTop + margin) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 function sortUnique(arr, f) { | 62 function sortUnique(arr, f) { |
63 arr = arr.sort(f); | 63 arr = arr.sort(f); |
64 let ret = [arr[0]]; | 64 let ret = [arr[0]]; |
65 for (var i = 1; i < arr.length; i++) { | 65 for (var i = 1; i < arr.length; i++) { |
66 if (arr[i-1] !== arr[i]) { | 66 if (arr[i-1] !== arr[i]) { |
67 ret.push(arr[i]); | 67 ret.push(arr[i]); |
68 } | 68 } |
69 } | 69 } |
70 return ret; | 70 return ret; |
71 } | 71 } |
| 72 |
| 73 // Partial application without binding the receiver |
| 74 function partial(f) { |
| 75 var arguments1 = Array.prototype.slice.call(arguments, 1); |
| 76 return function() { |
| 77 var arguments2 = Array.from(arguments); |
| 78 f.apply(this, arguments1.concat(arguments2)); |
| 79 } |
| 80 } |
OLD | NEW |