mirror of
https://github.com/discourse/discourse.git
synced 2025-01-25 03:19:29 +08:00
16 lines
314 B
JavaScript
16 lines
314 B
JavaScript
const Model = Ember.Object.extend();
|
|
|
|
Model.reopenClass({
|
|
extractByKey(collection, klass) {
|
|
const retval = {};
|
|
if (Ember.isEmpty(collection)) { return retval; }
|
|
|
|
collection.forEach(function(item) {
|
|
retval[item.id] = klass.create(item);
|
|
});
|
|
return retval;
|
|
}
|
|
});
|
|
|
|
export default Model;
|