javascript-natural-sort icon indicating copy to clipboard operation
javascript-natural-sort copied to clipboard

Added support for sorting an array of objects using myObject.sortKey

Open laurenceks opened this issue 4 years ago • 0 comments

Tweaked two lines in naturalSort.js so that it will look for a key called ".sortKey" and use that as a comparison value before falling back to comparing a/b itself. This allows an array of objects to be sorted by setting the object's .sortKey key to whatever value you want to sort without affecting original behaviour.

laurenceks avatar Aug 07 '20 08:08 laurenceks