mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -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) {
|
||||
buffer.push(Array(diff).fill());
|
||||
}
|
||||
buffer.push(values[i]);
|
||||
count += values[i].length + diff;
|
||||
const value = values[i];
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user