13 lines
282 B
CoffeeScript
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
|