20 lines
2.5 KiB
JavaScript
20 lines
2.5 KiB
JavaScript
let smartenv = require('../dist/index.js');
|
|
let beautylog = require('beautylog');
|
|
smartenv.printEnv();
|
|
// test smartenv.obs.add
|
|
smartenv.obs.add('myTestObject', { key1: 'Peter' });
|
|
smartenv.obs.add('myTestObject', { key1: 'Klaus' }); //now trying to add a second
|
|
smartenv.printEnv();
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1); // this should be Peter
|
|
// test smartenv.obs.replace
|
|
smartenv.obs.replace('myTestObject', { key1: 'Klaus' });
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1); // this should be Klaus
|
|
// test smartenv.obs.merge
|
|
smartenv.obs.merge('myTestObject', { key2: 'Peter' });
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1 + smartenv.obs.get('myTestObject').key2);
|
|
// this should be KlausPeter
|
|
let key2 = 'hello';
|
|
smartenv.obs.get('myTestObject').key2 = key2;
|
|
beautylog.log(smartenv.obs.get('myTestObject').key2);
|
|
beautylog.success('Success!');
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUE7QUFDMUMsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFBO0FBQ3BDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsQ0FBQTtBQUVuQix3QkFBd0I7QUFDeEIsUUFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsY0FBYyxFQUFDLEVBQUMsSUFBSSxFQUFDLE9BQU8sRUFBQyxDQUFDLENBQUE7QUFDL0MsUUFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsY0FBYyxFQUFDLEVBQU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