reshape to no dimensions

I hope you don't mind me sneaking an executable line in between var declarations.  Makes it not have to do a redundant test. :)
snap7
brianharvey 2021-07-16 21:28:08 -07:00
rodzic 9379ba833c
commit 476c4d8859
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -687,9 +687,9 @@ List.prototype.reshape = function (dimensions) {
// answer a new list formatted to fit the given dimensions.
// truncate excess elements, if any.
// pad with (repetitions of) existing elements
var src = this.ravel().itemsArray(),
size = dimensions.isEmpty() ? 0
: dimensions.itemsArray().reduce((a, b) => a * b),
var src = this.ravel().itemsArray();
if (dimensions.isEmpty()) return src[0];
var size = dimensions.itemsArray().reduce((a, b) => a * b),
i = 0,
trg;