mirror of
https://github.com/github/semantic.git
synced 2024-11-25 11:04:00 +03:00
Construct Syntax as a sum type.
This commit is contained in:
parent
87cdba8e4b
commit
ff21b7d299
@ -229,9 +229,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Syntax(json, continuation) {
|
function Syntax(json, continuation) {
|
||||||
if (json instanceof Array) { this.indexed = new Indexed(json, continuation); }
|
if (json instanceof Array) { this.indexed = json.map(continuation); }
|
||||||
else if (json instanceof Object) { this.keyed = new Keyed(json, continuation); }
|
else if (json instanceof Object) { this.keyed = (new Dictionary(json)).map(continuation); }
|
||||||
else this.leaf = new Leaf(json);
|
else this.leaf = json;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user