| // Copyright (c) 2024, the R8 project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| Array.prototype.any = function(predicate) { |
| for (const element of this.values()) { |
| if (predicate(element)) { |
| Array.prototype.first = function() { |
| Array.prototype.avg = function() { |
| return this.reduce(function(x, y) { return x + y; }, 0) / this.length; |
| Array.prototype.min = function() { |
| return this.reduce(function(x, y) { return x === null ? y : Math.min(x, y); }, null); |
| Array.prototype.reverseInPlace = function() { |
| for (var i = 0; i < Math.floor(this.length / 2); i++) { |
| this[i] = this[this.length - i - 1]; |
| this[this.length - i - 1] = temp; |
| Number.prototype.ns_to_s = function() { |
| const seconds = this/10E8; |
| const seconds_with_one_decimal = Math.round(seconds*10)/10; |