diff --git a/index.js b/index.js index b83bb72..093123f 100644 --- a/index.js +++ b/index.js @@ -11,8 +11,11 @@ const sortby = (properties) => (a, b) => { i++ } - if (a[property] < b[property]) return order - if (a[property] > b[property]) return -order + const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' }) + const compare = collator.compare(a[property], b[property]) + if (compare > 0) return order + if (compare < 0) return -order + } return 0