@jsonjoy.com/json-type
Version:
High-performance JSON Pointer implementation
53 lines • 1.55 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractCodegen = void 0;
class AbstractCodegen {
compile() {
return this.codegen.compile();
}
onNode(path, r, type) {
const kind = type.kind();
switch (kind) {
case 'any':
this.onAny(path, r, type);
break;
case 'con':
this.onCon(path, r, type);
break;
case 'bool':
this.onBool(path, r, type);
break;
case 'num':
this.onNum(path, r, type);
break;
case 'str':
this.onStr(path, r, type);
break;
case 'bin':
this.onBin(path, r, type);
break;
case 'arr':
this.onArr(path, r, type);
break;
case 'obj':
this.onObj(path, r, type);
break;
case 'key':
this.onKey(path, r, type);
break;
case 'map':
this.onMap(path, r, type);
break;
case 'ref':
this.onRef(path, r, type);
break;
case 'or':
this.onOr(path, r, type);
break;
default:
throw new Error(`Unsupported kind: ${kind}`);
}
}
}
exports.AbstractCodegen = AbstractCodegen;
//# sourceMappingURL=AbstractCodege.js.map