- Accept
Array#sort(comparator)
comparator method as deterministic option value to use that comparator for sorting object keys.
import { configure } from 'safe-stable-stringify'
const object = {
a: 1,
b: 2,
c: 3,
}
const stringify = configure({
deterministic: (a, b) => b.localeCompare(a)
})
stringify(object)
// '{"c": 3,"b":2,"a":1}'
- Very minor performance optimization.
Thanks to @flobernd, @cesco69 and @prisis to contribute to this release!