UNPKG

@typespec/http-server-js

Version:

TypeSpec HTTP server code generator for JavaScript

26 lines 803 B
// Copyright (c) Microsoft Corporation // Licensed under the MIT license. /** * Computes the fully-qualified name of a TypeSpec type, i.e. `TypeSpec.boolean` for the built-in `boolean` scalar. */ export function getFullyQualifiedTypeName(type) { const name = type.name ?? "<unknown>"; if (type.namespace) { const nsPath = getFullyQualifiedNamespacePath(type.namespace); return (nsPath[0] === "" ? nsPath.slice(1) : nsPath).join(".") + "." + name; } else { return name; } } function getFullyQualifiedNamespacePath(ns) { if (ns.namespace) { const innerPath = getFullyQualifiedNamespacePath(ns.namespace); innerPath.push(ns.name); return innerPath; } else { return [ns.name]; } } //# sourceMappingURL=name.js.map