[Implement] Buffer.concat by jtenner · Pull Request #5 · AssemblyScript/node
Current problems:
No good logging for that extendArrayBufferView(opened issue with as-pect https://github.com/jtenner/as-pect/issues/132 )No good way of comparing things that extendArrayBufferView(opened issue with as-pect https://github.com/jtenner/as-pect/issues/133 )
expect<Buffer>(actual).toStrictEqual(expected); // should compare lengths and values
No good way to create a buffer from scratch without a naiveBuffer.from<T>()functionCould create a helper function, but that's a todo
This pull request is not blocked by anything. Current questions:
- Should we set the length parameter to
i32.MAX_VALUE? - Any suggestions for optimizations?
- Should we do a
nullcheck on the array? (in case of uninitialized field problems?)
I think I'm going to implement a test function for utility purposes.
function bufferFrom(values: i32[]): Buffer { let length = values.lengrh; let buffer = Buffer.allocUnsafe(length); for (let i = 0; i < length; i++) buffer[i] = u8(unchecked(values[i])); return buffer; }
This should be relatively safe for testing.
jtenner
changed the title
[Implement] Naive Buffer.concat<T>
[Implement] Naive Buffer.concat
jtenner
changed the title
[Implement] Naive Buffer.concat
[Implement] Buffer.concat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters