node
node copied to clipboard
[Implement] Buffer.compare
Notes:
- this function works really nicely with
memory.compare()
- ~Currently, the compiler doesn't like using
static
functions as function parameters (Will open an issue in the AssemblyScript repo)~
ERROR AS218: Cannot access method 'compare' without calling it as it requires 'this' to be set.
actual.sort(Buffer.compare);
~~~~~~~~~~~~~~
in tests/buffer.spec.ts(60,16)
Edit:
- ~Switching to
static readonly
function expression causes this to compile~
With the static function fix, everything seems to look nice. Thoughts? @dcodeIO
TODO: Implement Buffer#compare
.
TODO: Return 1, 0, or -1