* Deprecated. Static, not-in-place variant of Array#sort. * @param {!Array} array * @return {!Array}
(array)
| 76 | * @return {!Array} |
| 77 | */ |
| 78 | function sort(array) { |
| 79 | if (!isArray(array)) { |
| 80 | throw new Error(`sort: ${array} is not an array.`); |
| 81 | } |
| 82 | const copy = Array.prototype.slice.call(array); |
| 83 | Array.prototype.sort.call(copy); |
| 84 | return copy; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Needs to be wrapped to avoid a duplicate name conflict with the deprecated |