npm.io
1.0.3 • Published 7 years ago

lodash-sorted-pairs

Licence
ISC
Version
1.0.3
Deps
1
Size
2 kB
Vulns
0
Weekly
0
Stars
1

lodash-sorted-pairs

Get sorted pairs (key, value) from an object using lodash.

import sortedPairs from 'lodash-sorted-pairs'

const object = { b: 1, a: 2 }

// Sort by key:
sortedPairs(object)
// -> [ ['a', 2], ['b', 1] ]

// Or pass a sorted on pairs from `_.toPairs`:
sortedPairs(object, _.property('1'))
// -> [ ['b', 1], ['a', 2] ]

Keywords