How to sort two array of objects using Underscore.js?
Or you can do it without a function at all:

sortBy   _.sortBy(list, iterator, [context])
Returns a (stably) sorted copy of list, ranked in ascending order by the results of running each value through iterator.  Iterator may also be the string name of the property to sort by (eg. length).

var sorted1 = _.sortBy(O1, 'name'),
    sorted2 = _.sortBy(O2, 'name');