no more infinite loops?
parent
488d13c100
commit
45d938874d
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "frigid",
|
"name": "frigid",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ export default class Frigid extends Serializable {
|
||||||
function walk(obj, transform, done = new Map()) {
|
function walk(obj, transform, done = new Map()) {
|
||||||
if(obj instanceof Serializable) {
|
if(obj instanceof Serializable) {
|
||||||
transform(obj);
|
transform(obj);
|
||||||
if(reverseLookup(done, obj) === null) {
|
|
||||||
done.set(done.size, obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for(const key of Object.keys(obj)) {
|
if(reverseLookup(done, obj) === null) {
|
||||||
const val = obj[key];
|
done.set(done.size, obj);
|
||||||
if(typeof obj === 'object') {
|
for(const key of Object.keys(obj)) {
|
||||||
walk(val, transform, done);
|
const val = obj[key];
|
||||||
|
if(typeof obj === 'object') {
|
||||||
|
walk(val, transform, done);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue