UNPKG

ts-json-schema-generator

Version:

Generate JSON schema from your Typescript sources

22 lines 672 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.typeName = void 0; const Errors_js_1 = require("../Error/Errors.js"); function typeName(value) { if (value === null) { return "null"; } const type = typeof value; if (type === "string" || type === "number" || type === "boolean") { return type; } if (Array.isArray(value)) { return "array"; } if (type === "object") { return "object"; } throw new Errors_js_1.ExpectationFailedError(`JavaScript type "typeof " can't be converted to JSON type name`); } exports.typeName = typeName; //# sourceMappingURL=typeName.js.map