.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tslint / lib / rules / completed-docs / exclusions.js
1 "use strict";
2 /**
3  * @license
4  * Copyright 2013 Palantir Technologies, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 Object.defineProperty(exports, "__esModule", { value: true });
19 var completedDocsRule_1 = require("../completedDocsRule");
20 var blockExclusion_1 = require("./blockExclusion");
21 var classExclusion_1 = require("./classExclusion");
22 var tagExclusion_1 = require("./tagExclusion");
23 exports.constructExclusionsMap = function (ruleArguments) {
24     var exclusions = new Map();
25     for (var _i = 0, ruleArguments_1 = ruleArguments; _i < ruleArguments_1.length; _i++) {
26         var ruleArgument = ruleArguments_1[_i];
27         addRequirements(exclusions, ruleArgument);
28     }
29     return exclusions;
30 };
31 var addRequirements = function (exclusionsMap, descriptors) {
32     if (typeof descriptors === "string") {
33         exclusionsMap.set(descriptors, createRequirementsForDocType(descriptors, {}));
34         return;
35     }
36     for (var _i = 0, _a = Object.keys(descriptors); _i < _a.length; _i++) {
37         var docType = _a[_i];
38         exclusionsMap.set(docType, createRequirementsForDocType(docType, descriptors[docType]));
39     }
40 };
41 var createRequirementsForDocType = function (docType, descriptor) {
42     var requirements = [];
43     var overloadsSeparateDocs = false;
44     if (typeof descriptor === "object" && completedDocsRule_1.DESCRIPTOR_OVERLOADS in descriptor) {
45         overloadsSeparateDocs = !!descriptor[completedDocsRule_1.DESCRIPTOR_OVERLOADS];
46     }
47     if (docType === "methods" || docType === "properties") {
48         requirements.push(new classExclusion_1.ClassExclusion(descriptor));
49     }
50     else {
51         requirements.push(new blockExclusion_1.BlockExclusion(descriptor));
52     }
53     if (descriptor.tags !== undefined) {
54         requirements.push(new tagExclusion_1.TagExclusion(descriptor));
55     }
56     return {
57         overloadsSeparateDocs: overloadsSeparateDocs,
58         requirements: requirements,
59     };
60 };