[Implement] Buffer.compare by jtenner · Pull Request #7 · AssemblyScript/node

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Open

[Implement] Buffer.compare#7

jtenner wants to merge 2 commits intomainfrom

compare

Conversation

@jtenner

Copy link Copy Markdown

Contributor

@jtenner jtenner commented

Jul 19, 2019

edited

Loading

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

@jtenner

Copy link Copy Markdown

Contributor Author

jtenner commented

Jul 23, 2019

With the static function fix, everything seems to look nice. Thoughts? @dcodeIO

@jtenner

Copy link Copy Markdown

Contributor Author

jtenner commented

Aug 1, 2019

TODO: Implement Buffer#compare.
TODO: Return 1, 0, or -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dcodeIO dcodeIO Awaiting requested review from dcodeIO

Assignees

@jtenner jtenner

Labels

enhancement

New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@jtenner