UNPKG

@jsonjoy.com/json-type

Version:

High-performance JSON Pointer implementation

28 lines (27 loc) 739 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StrType = void 0; const asString_1 = require("@jsonjoy.com/util/lib/strings/asString"); const AbsType_1 = require("./AbsType"); class StrType extends AbsType_1.AbsType { constructor(schema) { super(); this.schema = schema; } format(format) { this.schema.format = format; return this; } min(min) { this.schema.min = min; return this; } max(max) { this.schema.max = max; return this; } toJson(value, system = this.system) { return (this.schema.noJsonEscape ? '"' + value + '"' : (0, asString_1.asString)(value)); } } exports.StrType = StrType;