mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 19:01:54 +08:00
14 lines
331 B
JavaScript
14 lines
331 B
JavaScript
Discourse.Model = Ember.Object.extend(Discourse.Presence);
|
|
|
|
Discourse.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;
|
|
}
|
|
});
|