SHIFT + D

sort

Updated on August 22, 2024Source codeTests

createSort is a pipe that transforms an array to a sorted array.

Create sort

Call createSort with these parameters to create your sort function:

Parameter
Type
Required
Description
compare
Function
yes

A function that compares two items in the array.

It should return a negative number if the first item should have a lower sort position than the second item, a positive number if the first item should have a higher sort position than the second item, or 0 if the items should remain in place.

someswap

Edit doc on GitHub

ON THIS PAGE

sortCreate sort