UNPKG

@azure-tools/codegen

Version:
42 lines 985 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.typeOf = exports.isPrimitive = void 0; function isPrimitive(instance) { switch (typeof instance) { case "undefined": case "boolean": case "number": case "string": case "symbol": return true; default: return false; } } exports.isPrimitive = isPrimitive; function typeOf(obj) { if (obj === null) { return "null"; } const t = typeof obj; if (t === "object") { if (Array.isArray(obj)) { return "array"; } if (obj instanceof Set) { return "set"; } if (obj instanceof Map) { return "map"; } if (obj instanceof Date) { return "date"; } if (obj instanceof RegExp) { return "regexp"; } } return t; } exports.typeOf = typeOf; //# sourceMappingURL=type.js.map