mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-14 19:54:43 +08:00
16 lines
387 B
JavaScript
16 lines
387 B
JavaScript
|
|
||
|
export class AbstractCollectionModel extends Array
|
||
|
{
|
||
|
constructor(props) {
|
||
|
super();
|
||
|
props && Object.entries(props).forEach(([key, value]) => '@' !== key[0] && (this[key] = value));
|
||
|
// props[@Count]
|
||
|
}
|
||
|
|
||
|
static getFromJSON(object, name) {
|
||
|
return object && 'Collection/'+name === object['@Object'] && Array.isArray(object['@Collection'])
|
||
|
? object['@Collection']
|
||
|
: null;
|
||
|
}
|
||
|
}
|