Files

21 lines
619 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* combined データの pack / unpack(Python utils/primitives_data.py と同等)
*/
export function packCombinedPrimitives(values, types) {
return { values: [...values], types: [...types] }
}
export function unpackCombinedPrimitives(combined) {
if (!combined || typeof combined !== "object") {
return { values: [], types: [], length: 0 }
}
const values = combined.values ?? []
const types = combined.types ?? []
const typeList = [...types]
while (typeList.length < values.length) {
typeList.push("STRING")
}
return { values: [...values], types: typeList, length: values.length }
}