remove some extraneous logging
parent
57172ce9a9
commit
79e550c915
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "frigid",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.7",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ function finalze(instance, filename) {
|
|||
instance[PERSIST_LOCATION] = filename;
|
||||
|
||||
walk(instance, (obj) => {
|
||||
// console.log(obj instanceof Serializable)
|
||||
obj[INVOKE_CTOR]();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ export default class Serializable {
|
|||
}
|
||||
|
||||
toJson() {
|
||||
if(this[DEBUG]) {
|
||||
// if(this[DEBUG]) {
|
||||
return JSON.stringify(this.toSerializableObject(), null, 2);
|
||||
} else {
|
||||
return JSON.stringify(this.toSerializableObject());
|
||||
}
|
||||
// } else {
|
||||
// return JSON.stringify(this.toSerializableObject());
|
||||
// }
|
||||
}
|
||||
|
||||
static fromJson(str: string, instances: Map<number, object> = new Map()) {
|
||||
|
|
@ -86,8 +86,6 @@ export default class Serializable {
|
|||
}
|
||||
|
||||
if(obj instanceof Serializable) clone[Serializable.CLASS_REFERENCE] = obj.constructor.name;
|
||||
|
||||
// console.log('recorded instance', newId, obj, instances);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
|
@ -104,7 +102,6 @@ export default class Serializable {
|
|||
}
|
||||
|
||||
static fromSerializableObject(obj: any, instances: Map<number, object> = new Map()) {
|
||||
// console.log('deserializing', obj);
|
||||
if(obj[Serializable.CLASS_REFERENCE] !== this.name) return null;
|
||||
|
||||
const transformValue = (val: any): any => {
|
||||
|
|
@ -144,7 +141,6 @@ export default class Serializable {
|
|||
constructedObject = clone;
|
||||
|
||||
if(Serializable.INSTANCE_DECLARATION in obj) {
|
||||
// console.log('recording instance', obj[Serializable.INSTANCE_DECLARATION], constructedObject);
|
||||
instances.set(obj[Serializable.INSTANCE_DECLARATION], constructedObject);
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +161,6 @@ export default class Serializable {
|
|||
|
||||
const secondPassObjectsCompleted = new Map();
|
||||
const secondPass = (obj) => {
|
||||
console.log('second passing', obj);
|
||||
for(const key of Object.keys(obj)) {
|
||||
if(key === Serializable.INSTANCE_DECLARATION) delete obj[key];
|
||||
if(key === Serializable.CLASS_REFERENCE) delete obj[key];
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export {default as Serializable} from './Serializable.js';
|
||||
export {default as Serializable, DEBUG} from './Serializable.js';
|
||||
export {default as Frigid} from './Frigid.js'
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
export function reverseLookup<K, V>(map: Map<K, V>, value: V): K {
|
||||
// console.log('searching for', value, 'in', map);
|
||||
for (const [k, v] of map) {
|
||||
if (v === value) {
|
||||
// console.log('found in key', k);
|
||||
return k;
|
||||
}
|
||||
}
|
||||
// console.log(value, 'not found')
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue