@jsonjoy.com/json-type
Version:
High-performance JSON Pointer implementation
31 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MapType = void 0;
const tslib_1 = require("tslib");
const printTree_1 = require("tree-dump/lib/printTree");
const schema = tslib_1.__importStar(require("../../schema"));
const AbsType_1 = require("./AbsType");
class MapType extends AbsType_1.AbsType {
constructor(_value, _key, options) {
super({ kind: 'map', value: schema.s.any, ...(_key && { key: schema.s.any }), ...options });
this._value = _value;
this._key = _key;
}
getSchema(ctx) {
return {
...this.schema,
value: this._value.getSchema(ctx),
...(this._key && { key: this._key.getSchema(ctx) }),
};
}
getOptions() {
// biome-ignore lint: unused variables are intentional
const { kind, value, key, ...options } = this.schema;
return options;
}
toString(tab = '') {
return super.toString(tab) + (0, printTree_1.printTree)(tab, [(tab) => this._value.toString(tab)]);
}
}
exports.MapType = MapType;
//# sourceMappingURL=MapType.js.map