1 import Settings from './Settings';
2 import Keychain from './Keychain';
3 import Meta from './Meta';
5 export default class BytomObj {
8 this.meta = Meta.placeholder();
9 this.settings = Settings.placeholder();
10 this.keychain = Keychain.placeholder();
14 static placeholder(){ return new BytomObj(); }
15 static fromJson(json){
16 let p = Object.assign(this.placeholder(), json);
17 if(json.hasOwnProperty('meta')) p.meta = Meta.fromJson(json.meta);
18 if(json.hasOwnProperty('settings')) p.settings = Settings.fromJson(json.settings);
19 if(json.hasOwnProperty('keychain'))
20 p.keychain = (typeof json.keychain === 'string')
21 ? json.keychain : Keychain.fromJson(json.keychain);
26 clone(){ return BytomObj.fromJson(JSON.parse(JSON.stringify(this))) }