mirror of
https://github.com/discourse/discourse.git
synced 2025-02-04 08:57:30 +08:00
18 lines
381 B
JavaScript
18 lines
381 B
JavaScript
import Presence from 'discourse/mixins/presence';
|
|
|
|
const Model = Ember.Object.extend(Presence);
|
|
|
|
Model.reopenClass({
|
|
extractByKey: function(collection, klass) {
|
|
var retval = {};
|
|
if (Ember.isEmpty(collection)) { return retval; }
|
|
|
|
collection.forEach(function(item) {
|
|
retval[item.id] = klass.create(item);
|
|
});
|
|
return retval;
|
|
}
|
|
});
|
|
|
|
export default Model;
|