UNPKG

1.21 kBJavaScriptView Raw
1"use strict";
2// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3// See LICENSE in the project root for license information.
4Object.defineProperty(exports, "__esModule", { value: true });
5exports.Utilities = void 0;
6const api_extractor_model_1 = require("@microsoft/api-extractor-model");
7class Utilities {
8 /**
9 * Generates a concise signature for a function. Example: "getArea(width, height)"
10 */
11 static getConciseSignature(apiItem) {
12 if (api_extractor_model_1.ApiParameterListMixin.isBaseClassOf(apiItem)) {
13 return apiItem.displayName + '(' + apiItem.parameters.map((x) => x.name).join(', ') + ')';
14 }
15 return apiItem.displayName;
16 }
17 /**
18 * Converts bad filename characters to underscores.
19 */
20 static getSafeFilenameForName(name) {
21 // TODO: This can introduce naming collisions.
22 // We will fix that as part of https://github.com/microsoft/rushstack/issues/1308
23 return name.replace(Utilities._badFilenameCharsRegExp, '_').toLowerCase();
24 }
25}
26Utilities._badFilenameCharsRegExp = /[^a-z0-9_\-\.]/gi;
27exports.Utilities = Utilities;
28//# sourceMappingURL=Utilities.js.map
\No newline at end of file