.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tslint / lib / utils.d.ts
1 /**
2  * @license
3  * Copyright 2018 Palantir Technologies, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 /// <reference types="node" />
18 import * as ts from "typescript";
19 /**
20  * Enforces the invariant that the input is an array.
21  */
22 export declare function arrayify<T>(arg?: T | T[]): T[];
23 /**
24  * @deprecated (no longer used)
25  * Enforces the invariant that the input is an object.
26  */
27 export declare function objectify(arg: any): any;
28 export declare function hasOwnProperty(arg: {}, key: string): boolean;
29 /**
30  * Replace hyphens in a rule name by upper-casing the letter after them.
31  * E.g. "foo-bar" -> "fooBar"
32  */
33 export declare function camelize(stringWithHyphens: string): string;
34 export declare function isUpperCase(str: string): boolean;
35 export declare function isLowerCase(str: string): boolean;
36 /**
37  * Removes leading indents from a template string without removing all leading whitespace
38  */
39 export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string;
40 /**
41  * Strip comments from file content.
42  */
43 export declare function stripComments(content: string): string;
44 /**
45  * Escapes all special characters in RegExp pattern to avoid broken regular expressions and ensure proper matches
46  */
47 export declare function escapeRegExp(re: string): string;
48 /** Return true if both parameters are equal. */
49 export declare type Equal<T> = (a: T, b: T) => boolean;
50 export declare function arraysAreEqual<T>(a: ReadonlyArray<T> | undefined, b: ReadonlyArray<T> | undefined, eq: Equal<T>): boolean;
51 /** Returns the first non-`undefined` result. */
52 export declare function find<T, U>(inputs: T[], getResult: (t: T) => U | undefined): U | undefined;
53 /** Returns an array that is the concatenation of all output arrays. */
54 export declare function flatMap<T, U>(inputs: ReadonlyArray<T>, getOutputs: (input: T, index: number) => ReadonlyArray<U>): U[];
55 /** Returns an array of all outputs that are not `undefined`. */
56 export declare function mapDefined<T, U>(inputs: ReadonlyArray<T>, getOutput: (input: T) => U | undefined): U[];
57 export declare function readBufferWithDetectedEncoding(buffer: Buffer): string;
58 export declare type Encoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
59 export declare function detectBufferEncoding(buffer: Buffer, length?: number): Encoding;
60 export declare function trimSingleQuotes(str: string): string;
61 export declare function denormalizeWinPath(path: string): string;
62 export declare function isPascalCased(name: string): boolean;
63 export declare function isCamelCased(name: string): boolean;
64 export declare function isKebabCased(name: string): boolean;
65 export declare function isSnakeCased(name: string): boolean;
66 /**
67  * Tries to resolve a package by name, optionally relative to a file path. If the
68  * file path is under a symlink, it tries to resolve the package under both the real path and under
69  * the symlink path.
70  */
71 export declare function tryResolvePackage(packageName: string, relativeTo?: string): string | undefined;
72 /**
73  * Gets the full indentation of the provided node
74  */
75 export declare function getIndentation(node: ts.Node, sourceFile: ts.SourceFile): string;
76 /**
77  * Creates x new lines with a proper indentation at the last one based on the provided node
78  */
79 export declare function newLineWithIndentation(node: ts.Node, sourceFile: ts.SourceFile, linesCount?: number): string;
80 /**
81  * @deprecated Copied from tsutils 2.27.2. This will be removed once TSLint requires tsutils > 3.0.
82  */
83 export declare function isFunctionScopeBoundary(node: ts.Node): boolean;