Files
2017-12-21 11:42:41 +01:00

13 lines
282 B
CoffeeScript

sortNumeric = (target, keys...) ->
Ember.computed.sort target, (a, b) ->
[int_a, int_b] = [parseInt(a.get(keys[0])), parseInt(b.get(keys[0]))]
if int_a > int_b
1
else if int_a < int_b
-1
else
0
export { sortNumeric }
export default sortNumeric