natural-sort-by-key

2.2.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.2.0
    55
    • latest

Version History

Package Sidebar

Install

npm i natural-sort-by-key

Weekly Downloads

61

Version

2.2.0

License

ISC

Unpacked Size

35.2 kB

Total Files

5

Last publish

Collaborators

  • fantasyui.com