mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 22:29:28 -07:00
buildStruct needs to convert values into arrays
This commit is contained in:
@@ -81,8 +81,17 @@ const buildStruct = (layout, values) => {
|
|||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
buffer.push(Array(diff).fill());
|
buffer.push(Array(diff).fill());
|
||||||
}
|
}
|
||||||
buffer.push(values[i]);
|
const value = values[i];
|
||||||
count += values[i].length + diff;
|
let array;
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
array = value;
|
||||||
|
} else if (value[Symbol.iterator] != null) {
|
||||||
|
array = Array.from(value);
|
||||||
|
} else {
|
||||||
|
array = [value];
|
||||||
|
}
|
||||||
|
buffer.push(array);
|
||||||
|
count += array.length + diff;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const diff = sizeInBytes - count;
|
const diff = sizeInBytes - count;
|
||||||
|
|||||||
Reference in New Issue
Block a user