import type {AllExtend} from './all-extend.d.ts'; /** Returns a boolean for whether the given string literal is uppercase. @example ``` import type {IsUppercase} from 'type-fest'; IsUppercase<'ABC'>; //=> true IsUppercase<'Abc'>; //=> false IsUppercase; //=> boolean ``` */ export type IsUppercase = AllExtend<_IsUppercase, true>; /** Loops through each part in the string and returns a boolean array indicating whether each part is uppercase. */ type _IsUppercase = S extends `${infer First}${infer Rest}` ? _IsUppercase]> : [...Accumulator, IsUppercaseHelper]; /** Returns a boolean for whether an individual part of the string is uppercase. */ type IsUppercaseHelper = S extends Uppercase ? true : S extends Lowercase | Uncapitalize | `${string}${Lowercase}${string}` ? false : boolean; export {};