diff --git a/index.js b/index.js index 998c465..61a7698 100644 --- a/index.js +++ b/index.js @@ -9,9 +9,15 @@ const sortby = (properties) => (a, b) => { const property = properties[i] let order = -1 - if (i + 1 < properties.length && properties[i + 1] === 'desc') { - order = 1 - i++ + if (i + 1 < properties.length) { + const next = properties[i + 1] + + if (next === 'desc') { + order = 1 + i++ + } else if (next === 'asc') { + i++ + } } const compare = collator.compare(a[property], b[property])