UNPKG

eslint-plugin-complete

Version:

An ESLint plugin that contains useful rules.

32 lines 1.57 kB
export type ReadonlyRecord<K extends string | number | symbol, V> = Readonly<Record<K, V>>; /** * Helper function to throw an error if the provided value is equal to `undefined`. * * This is useful to have TypeScript narrow a `T | undefined` value to `T` in a concise way. */ export declare function assertDefined<T>(value: T, ...[msg]: [undefined] extends [T] ? [string] : [ "The assertion is useless because the provided value does not contain undefined." ]): asserts value is Exclude<T, undefined>; export declare function capitalizeFirstLetter(string: string): string; /** * From: * https://stackoverflow.com/questions/8334606/check-if-first-letter-of-word-is-a-capital-letter */ export declare function isFirstLetterCapitalized(string: string): boolean; /** * Helper function to narrow an unknown value to an object (i.e. a TypeScript record). * * Under the hood, this checks for `typeof variable === "object"`, `variable !== null`, and * `!Array.isArray(variable)`. */ export declare function isObject(variable: unknown): variable is Record<string, unknown>; /** * Helper function to trim a prefix from a string, if it exists. Returns the trimmed string. * * @param string The string to trim. * @param prefix The prefix to trim. * @param trimAll Whether to remove multiple instances of the prefix, if they exist. If this is set * to true, the prefix must only be a single character. */ export declare function trimPrefix(string: string, prefix: string, trimAll?: boolean): string; //# sourceMappingURL=completeCommon.d.ts.map