v0.6.0
Pre-release-
Support resizable
ArrayBufferand growableSharedArrayBufferES2024 introduced resizable
ArrayBufferand growableSharedArrayBuffer.
@bare-ts/libnow handle these new features by resizing and growing in-place the buffer
when it reserves space for writing.Note that the library still respects the
maxBufferLengthconfiguration.If
maxBufferLengthis greater than the buffer'smaxByteLength, while a new
buffer is allocated oncemaxByteLengthis exceeded.In the following code, the buffer is resized in-place when
writeFixedStringis called.import * as bare from "@bare-ts/lib" const resizableBuffer = new ArrayBuffer(0, { maxByteLength: 10 }) const config = bare.Config({ initialBufferLength: 0, maxBufferLength: 10 }) const bc = new bare.ByteCursor(new Uint8Array(resizableBuffer), config) bare.writeFixedString(bc, "bare")
-
Export
assert,DEVand integer validators@bare-ts/libnow exports anassertfunction and integer validators such asisI32.
We plan to use these functions in a future version of@bare-ts/tools.The library also exports a
DEVconstant that istrueif thedevelopmentcondition is passed,
or ifNODE_ENVis set todevelopmentunder thenodecondition.
Use the Node's CLI option--conditionsto pass thedevelopmentcondition.These functions should only be used for validating arguments of BARE decoders and encoders.