https://github.com/fantasyui-com/natural-sort-by-key
Sort array of objects by natural, human, alphanumeric order. Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are ordered as a single character. [Library, Sort]
https://github.com/fantasyui-com/natural-sort-by-key
Last synced: over 1 year ago
JSON representation
Sort array of objects by natural, human, alphanumeric order. Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are ordered as a single character. [Library, Sort]
- Host: GitHub
- URL: https://github.com/fantasyui-com/natural-sort-by-key
- Owner: fantasyui-com
- License: gpl-3.0
- Created: 2017-11-14T15:25:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-02T18:16:08.000Z (almost 4 years ago)
- Last Synced: 2025-02-11T15:49:32.542Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# natural-sort-by-key
Sort array of objects by natural, human, alphanumeric order. Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are ordered as a single character.
$> npm i natural-sort-by-key
const byKey = require('natural-sort-by-key');
list.sort( byKey('flarp') )
Where list is an array of objects
let list = [
{flarp: '10 Baz'},
{flarp: '100 Baz'},
{flarp: '20 Baz'},
]
More at [Wikipedia](https://en.wikipedia.org/wiki/Natural_sort_order)