Closed jrmyio closed 9 years ago
Yeah, this is definitely not working.
We need the code from collection (https://github.com/AmpersandJS/ampersand-collection/blob/master/ampersand-collection.js#L211-L239) that verifies comparator argument length and figures out what to do.
We should do this as part of AmpersandJS/ampersand#36 let's create a sortsort(array, comparator, options)
and does the right thing: Either plucking props from the items in the array, or calling a 1 or 2 argument function and does the right thing.
Closing this per the discussion in https://github.com/AmpersandJS/ampersand-state/pull/80#issuecomment-62478206
In the docs: "If you pass a function that names two incoming arguments it will be used as a native Array.prototype.sort, where you get passed two models and return a 1, 0, -1 to specify how they compare."
However, looking at the code i only see: if (this.comparator) newModels = _.sortBy(newModels, this.comparator);
Is this functionality implemented or am i missing something?