joelnet / MojiScript

MojiScript is an async-first, opinionated, and functional library

Home Page:https://mojiscript.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create a sort method

joelnet opened this issue · comments

Create list/sort.js

Expected:

const ascending = a => b => a - b

sort (ascending) ([ 1, 2, 3 ])

Should support range:

import range from 'mojiscript/list/range'

const ascending = a => b => a - b

sort (ascending) (range (0) (11))

Acceptance Criteria:

  • Should have 100% code coverage
  • Sorts arrays
  • Sorts iterables
  • Does not mutate original object.
  • Throws an exception if item to sort is not supported.

I can take a shot at this.

Awesome! Hit me up on Twitter if you have any questions!