-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
import { Codec } from '../src/utf15';
const codec = new Codec({ depth: 8, array: 1});
let data = [];
for (let x = 0; x < 32768; ++x)
data.push(1);
let enc_str = codec.encode(data);
RangeError: [utf15][RangeError]: x out of bounds: 32768
at assert (src/utf15.js:39:30)
at num_to_code_point (src/utf15.js:44:9)
at Codec.encode_array (src/utf15.js:107:41)
at Codec.encode (src/utf15.js:221:36)
It happens when an array of data has a length greater than can be expressed by a 15-bit number.
if(!depth_is_array) // Save array length as meta
res += String.fromCodePoint(num_to_code_point(values.length));
Reactions are currently unavailable