Ask questionsDocs: show example of passing a custom sort function

I took a quick gander through the code and it looks like you already support the ability to pass custom sorting functions. It would be nice to see an example of that. If you paste a simple example here, I'll do the work and create a PR. Thanks for creating this!


Answer questions puradox

Ah, I didn't notice there weren't any documentation about custom sorting functions. Thanks for catching that! It works almost identical to how Array.prototype.sort() works, with the only difference being the compare function is the second parameter.

sort(input: T[], compareFunc: (a: T, b: T) -> number) -> T[]

An example could be taken from the sift-sort.spec.ts. But here's something useful off the top of my head: sorting strings without respect to case.

const accounts = [
  { name: "Sam" },
  { name: "Ryan" },
  { name: "sally" },

  (a, b) =>,

Related questions

No questions were found.
Github User Rank List