import type { format as formatDate } from 'date-fns'; type __BasePath = O extends readonly Primitive_2[] ? number extends O['length'] ? `[${number}]` : undefined extends _BasePathOfObjectLike ? Exclude<_BasePathOfObjectLike, undefined> : _BasePathOfObjectLike : O extends object ? undefined extends _BasePathOfObjectLike ? Exclude<_BasePathOfObjectLike, undefined> : _BasePathOfObjectLike : ''; type __BasePathArray = O extends object ? undefined extends _BasePathArrayOfObjectLike ? Exclude<_BasePathArrayOfObjectLike, undefined> : _BasePathArrayOfObjectLike : readonly []; type __GetByPath< O, L, R extends readonly unknown[], > = O extends readonly unknown[] ? `${number}` extends L ? _GetByPath | undefined : L extends `${number}` ? number extends O['length'] ? _GetByPath | undefined : L extends keyof O ? _GetByPath : undefined : L extends keyof O ? _GetByPath : undefined : L extends keyof O ? _GetByPath : undefined; type AbsMap = { __: number; '-100': 100; '-99': 99; '-98': 98; '-97': 97; '-96': 96; '-95': 95; '-94': 94; '-93': 93; '-92': 92; '-91': 91; '-90': 90; '-89': 89; '-88': 88; '-87': 87; '-86': 86; '-85': 85; '-84': 84; '-83': 83; '-82': 82; '-81': 81; '-80': 80; '-79': 79; '-78': 78; '-77': 77; '-76': 76; '-75': 75; '-74': 74; '-73': 73; '-72': 72; '-71': 71; '-70': 70; '-69': 69; '-68': 68; '-67': 67; '-66': 66; '-65': 65; '-64': 64; '-63': 63; '-62': 62; '-61': 61; '-60': 60; '-59': 59; '-58': 58; '-57': 57; '-56': 56; '-55': 55; '-54': 54; '-53': 53; '-52': 52; '-51': 51; '-50': 50; '-49': 49; '-48': 48; '-47': 47; '-46': 46; '-45': 45; '-44': 44; '-43': 43; '-42': 42; '-41': 41; '-40': 40; '-39': 39; '-38': 38; '-37': 37; '-36': 36; '-35': 35; '-34': 34; '-33': 33; '-32': 32; '-31': 31; '-30': 30; '-29': 29; '-28': 28; '-27': 27; '-26': 26; '-25': 25; '-24': 24; '-23': 23; '-22': 22; '-21': 21; '-20': 20; '-19': 19; '-18': 18; '-17': 17; '-16': 16; '-15': 15; '-14': 14; '-13': 13; '-12': 12; '-11': 11; '-10': 10; '-9': 9; '-8': 8; '-7': 7; '-6': 6; '-5': 5; '-4': 4; '-3': 3; '-2': 2; '-1': 1; }; type Alphabet = | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'; type And2 = A extends True ? B : False; type AppendPrev = S extends '' ? AS : [...AS, S]; type _AppendPrev, S extends Str> = S extends '' ? AS : [...AS, S]; type Apply1 = ReturnType< (F & { readonly _1: _1; })['new'] >; type Apply2 = ReturnType< (F & { readonly _1: _1; readonly _2: _2; })['new'] >; type ArrayKeys = keyof []; type Ary = readonly unknown[]; export declare namespace Ary { export type OfWritable = T[]; export interface OfWritable$ extends HKT1 { new: (x: Assume) => OfWritable; } export type OfReadonly = readonly T[]; export interface OfReadonly$ extends HKT1 { new: (x: Assume) => OfReadonly; } export type IsWritable = AS extends unknown[] ? true : false; export interface isWritable$ extends HKT1 { new: (as: Assume) => IsWritable; } export type IfWritable = If< IsWritable, Then, Else >; export interface IfMutable$ extends HKT1 { new: (as: Assume) => IfWritable; } export interface IfMutable$$ extends HKT2 { new: ( as: Assume, then: Assume, ) => IfWritable; } export interface IfMutable$$$ extends HKT3 { new: ( as: Assume, then: Assume, else_: Assume, ) => IfWritable; } export type IsReadonly = Not>; export interface IsReadonly$ extends HKT1 { new: (as: Assume) => IsReadonly; } export type IfReadonly = If< IsReadonly, Then, Else >; export interface IfReadonly$ extends HKT1 { new: (as: Assume) => IfReadonly; } export interface IfReadonly$$ extends HKT2 { new: ( as: Assume, then: Assume, ) => IfReadonly; } export interface IfReadonly$$$ extends HKT3 { new: ( as: Assume, then: Assume, else_: Assume, ) => IfReadonly; } export type Elem = AS[number]; export interface Elem$ extends HKT1 { new: (as: Assume) => (typeof as)[number]; } export type ElemOrUndefined = Elem | undefined; export interface ElemOrUndefined$ extends HKT1 { new: (as: Assume) => ElemOrUndefined; } export type Mutate = IfWritable; export interface Mutate$ extends HKT1 { new: (as: Assume) => Mutate; } export interface Mutate$$ extends HKT2 { new: ( as: Assume, x: Assume, ) => Mutate; } export type Mix = IfWritable< AS, Array, ReadonlyArray >; export interface Mix$ extends HKT1 { new: (as: Assume) => Mix; } export interface Mix$$ extends HKT2 { new: ( as: Assume, x: Assume, ) => Mix; } } type Assume = T extends U ? T : U; type BasePath = _BasePath[0]> extends `.${infer R}` ? R : _BasePath[0]>; type _BasePath = __BasePath[0]>; type BasePathArray = _BasePathArray[0]>; type _BasePathArray = __BasePathArray[0]>; type _BasePathArrayOfObjectLike = ValueOf<{ [P in keyof O as P extends string | number ? O extends readonly unknown[] ? number extends O['length'] ? P extends Exclude ? never : P : P extends ArrayKeys ? never : P : P : never]: P extends string | number ? `${P}` extends `${number}` ? readonly [`${P}`] | readonly [`${P}`, ..._BasePathArray] : P extends string ? readonly [P] | readonly [P, ..._BasePathArray] : readonly [] : readonly []; }>; type _BasePathOfObjectLike = ValueOf<{ [P in keyof O as P extends string | number ? O extends readonly unknown[] ? number extends O['length'] ? P extends Exclude ? never : P : P extends ArrayKeys ? never : P : P : never]: P extends string | number ? `${P}` extends `${number}` ? `[${P}]` | `[${P}]${_BasePath}` : P extends string ? IsIdentifierName

extends true ? `.${P}` | `.${P}${_BasePath}` : `['${Escape

}']` | `['${Escape

}']${_BasePath}` : never : never; }>; type Bool = boolean; declare namespace Bool { type Not = B extends True ? False : True; interface Not$ extends HKT1 { new: (b: Assume) => Not; } } type CallableArray unknown> = F & { [P in keyof T[] as P extends 'length' ? never : P]: T[][P]; } & { length: number; toArray: () => T[]; }; type Cast = T extends U ? T : U; type Compact = number extends AS['length'] ? Array> : AS extends [] | readonly [] ? [] : Array>; interface Covers$ extends HKT1 { new: (x: Assume) => Covers; } type Covers = U extends T ? True : False; type Dec = N extends number ? `${N}` extends keyof DecMap_2 ? DecMap_2[`${N}`] : DecMap_2['__'] : `${N}` extends keyof DecMap_2 ? `${DecMap_2[`${N}`]}` : `${DecMap_2['__']}`; type DecMap = { __: number; '-99': -100; '-98': -99; '-97': -98; '-96': -97; '-95': -96; '-94': -95; '-93': -94; '-92': -93; '-91': -92; '-90': -91; '-89': -90; '-88': -89; '-87': -88; '-86': -87; '-85': -86; '-84': -85; '-83': -84; '-82': -83; '-81': -82; '-80': -81; '-79': -80; '-78': -79; '-77': -78; '-76': -77; '-75': -76; '-74': -75; '-73': -74; '-72': -73; '-71': -72; '-70': -71; '-69': -70; '-68': -69; '-67': -68; '-66': -67; '-65': -66; '-64': -65; '-63': -64; '-62': -63; '-61': -62; '-60': -61; '-59': -60; '-58': -59; '-57': -58; '-56': -57; '-55': -56; '-54': -55; '-53': -54; '-52': -53; '-51': -52; '-50': -51; '-49': -50; '-48': -49; '-47': -48; '-46': -47; '-45': -46; '-44': -45; '-43': -44; '-42': -43; '-41': -42; '-40': -41; '-39': -40; '-38': -39; '-37': -38; '-36': -37; '-35': -36; '-34': -35; '-33': -34; '-32': -33; '-31': -32; '-30': -31; '-29': -30; '-28': -29; '-27': -28; '-26': -27; '-25': -26; '-24': -25; '-23': -24; '-22': -23; '-21': -22; '-20': -21; '-19': -20; '-18': -19; '-17': -18; '-16': -17; '-15': -16; '-14': -15; '-13': -14; '-12': -13; '-11': -12; '-10': -11; '-9': -10; '-8': -9; '-7': -8; '-6': -7; '-5': -6; '-4': -5; '-3': -4; '-2': -3; '-1': -2; '0': -1; '1': 0; '2': 1; '3': 2; '4': 3; '5': 4; '6': 5; '7': 6; '8': 7; '9': 8; '10': 9; '11': 10; '12': 11; '13': 12; '14': 13; '15': 14; '16': 15; '17': 16; '18': 17; '19': 18; '20': 19; '21': 20; '22': 21; '23': 22; '24': 23; '25': 24; '26': 25; '27': 26; '28': 27; '29': 28; '30': 29; '31': 30; '32': 31; '33': 32; '34': 33; '35': 34; '36': 35; '37': 36; '38': 37; '39': 38; '40': 39; '41': 40; '42': 41; '43': 42; '44': 43; '45': 44; '46': 45; '47': 46; '48': 47; '49': 48; '50': 49; '51': 50; '52': 51; '53': 52; '54': 53; '55': 54; '56': 55; '57': 56; '58': 57; '59': 58; '60': 59; '61': 60; '62': 61; '63': 62; '64': 63; '65': 64; '66': 65; '67': 66; '68': 67; '69': 68; '70': 69; '71': 70; '72': 71; '73': 72; '74': 73; '75': 74; '76': 75; '77': 76; '78': 77; '79': 78; '80': 79; '81': 80; '82': 81; '83': 82; '84': 83; '85': 84; '86': 85; '87': 86; '88': 87; '89': 88; '90': 89; '91': 90; '92': 91; '93': 92; '94': 93; '95': 94; '96': 95; '97': 96; '98': 97; '99': 98; '100': 99; }; type DecMap_2 = { __: number; '-99': -100; '-98': -99; '-97': -98; '-96': -97; '-95': -96; '-94': -95; '-93': -94; '-92': -93; '-91': -92; '-90': -91; '-89': -90; '-88': -89; '-87': -88; '-86': -87; '-85': -86; '-84': -85; '-83': -84; '-82': -83; '-81': -82; '-80': -81; '-79': -80; '-78': -79; '-77': -78; '-76': -77; '-75': -76; '-74': -75; '-73': -74; '-72': -73; '-71': -72; '-70': -71; '-69': -70; '-68': -69; '-67': -68; '-66': -67; '-65': -66; '-64': -65; '-63': -64; '-62': -63; '-61': -62; '-60': -61; '-59': -60; '-58': -59; '-57': -58; '-56': -57; '-55': -56; '-54': -55; '-53': -54; '-52': -53; '-51': -52; '-50': -51; '-49': -50; '-48': -49; '-47': -48; '-46': -47; '-45': -46; '-44': -45; '-43': -44; '-42': -43; '-41': -42; '-40': -41; '-39': -40; '-38': -39; '-37': -38; '-36': -37; '-35': -36; '-34': -35; '-33': -34; '-32': -33; '-31': -32; '-30': -31; '-29': -30; '-28': -29; '-27': -28; '-26': -27; '-25': -26; '-24': -25; '-23': -24; '-22': -23; '-21': -22; '-20': -21; '-19': -20; '-18': -19; '-17': -18; '-16': -17; '-15': -16; '-14': -15; '-13': -14; '-12': -13; '-11': -12; '-10': -11; '-9': -10; '-8': -9; '-7': -8; '-6': -7; '-5': -6; '-4': -5; '-3': -4; '-2': -3; '-1': -2; '0': -1; '1': 0; '2': 1; '3': 2; '4': 3; '5': 4; '6': 5; '7': 6; '8': 7; '9': 8; '10': 9; '11': 10; '12': 11; '13': 12; '14': 13; '15': 14; '16': 15; '17': 16; '18': 17; '19': 18; '20': 19; '21': 20; '22': 21; '23': 22; '24': 23; '25': 24; '26': 25; '27': 26; '28': 27; '29': 28; '30': 29; '31': 30; '32': 31; '33': 32; '34': 33; '35': 34; '36': 35; '37': 36; '38': 37; '39': 38; '40': 39; '41': 40; '42': 41; '43': 42; '44': 43; '45': 44; '46': 45; '47': 46; '48': 47; '49': 48; '50': 49; '51': 50; '52': 51; '53': 52; '54': 53; '55': 54; '56': 55; '57': 56; '58': 57; '59': 58; '60': 59; '61': 60; '62': 61; '63': 62; '64': 63; '65': 64; '66': 65; '67': 66; '68': 67; '69': 68; '70': 69; '71': 70; '72': 71; '73': 72; '74': 73; '75': 74; '76': 75; '77': 76; '78': 77; '79': 78; '80': 79; '81': 80; '82': 81; '83': 82; '84': 83; '85': 84; '86': 85; '87': 86; '88': 87; '89': 88; '90': 89; '91': 90; '92': 91; '93': 92; '94': 93; '95': 94; '96': 95; '97': 96; '98': 97; '99': 98; '100': 99; }; type Distribute = TUnions extends [ infer F, ...infer R, ] ? R extends unknown[] ? Distribute extends infer DR extends unknown[] ? F extends any ? [F, ...DR] : never : never : [F] : []; type Escape< S extends string | number, TQuoteType extends 'single' | 'double' = 'single', > = `${S}` extends `${infer L}${infer R}` ? L extends (TQuoteType extends 'single' ? "'" : '"') ? `\\${L}${Escape}` : L extends '\\' ? `\\\\${Escape}` : `${L}${Escape}` : S; type ExcludeBySequence = TS extends readonly [ infer THead, ...infer TTail, ] ? Exclude, THead> : A; type ExtendedObject = O & { /** * Returns the object itself, but hide all additional methods in TS. * * It does **not** actually hide the methods, it just makes them invisible in TS. If you want to hide them also in JS, use `purify` instead. * @example * ```typescript * const obj = { a: 1 }; * const obj2 = { ...ex(obj).filter(([, v]) => v > 0) }; // obj2 :: { a?: number | undefined, keys: () => ..., values: () => ..., ... } * const obj3 = { ...ex(obj).filter(([, v]) => v > 0).mask() }; // obj3 :: { a?: number | undefined } * ``` * * @see {@link ExtendedObject#purify} */ mask: () => O; /** * Returns a new object with all additional methods removed. * * Compared to `mask`, it actually removes the methods and returns a new one, but it also means this is less performant. * @example * ```typescript * const obj = { a: 1 }; * const obj2 = { ...ex(obj).filter(([, v]) => v > 0) }; // obj2 :: { a?: number | undefined, keys: () => ..., values: () => ..., ... } * const obj3 = { ...ex(obj).filter(([, v]) => v > 0).purify() }; // obj3 :: { a?: number | undefined } * ``` * * @see {@link ExtendedObject#mask} */ purify: () => O; /** * Returns the names of the enumerable string properties and methods of the object (using `Object.keysS`). * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).keys(); // => ['5', 'a', 'b', 'c'] * const keys = ex(obj).keys(); // keys :: ('5' | 'a' | 'b' | 'c')[] * ``` * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * for (const key of ex(obj).keys()) { * console.log(obj[key]); // No type error * } * ``` * * @see {@link Object.keysS} */ keys: () => StrictKeys; /** * Returns an array of values of the enumerable properties of the object (using `Object.valuesS`). * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).values(); // => [42, 1, 2, 3] * const values = ex(obj).values(); // values :: number[] * ``` * * @see {@link Object.valuesS} */ values: () => StrictValues; /** * Returns an array of key/values of the enumerable properties of the object (using `Object.entriesS`). * * @example * ```typescript * const obj = { a: 1, b: 2, c: true, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).entries(); // => [['5', 42], ['a', 1], ['b', 2], ['c', true]] * const entries = ex(obj).entries(); // entries :: (['5', number] | ['a', number] | ['b', number] | ['c', boolean])[] * ``` * * @see {@link Object.entriesS} */ entries: () => StrictEntries; /** * Returns the number of enumerable properties and methods of the object or the length of the object if it is an array-like object (using `Object.size`) * * @example * ```typescript * ex({ a: 1, b: 2, c: 3 }).size(); // => 3 * ex({ length: 3 }).size(); // => 3 * ex(new Map([['a', 1], ['b', 2], ['c', 3]])).size(); // => 3 * ex(new Set([1, 2, 3, 4])).size(); // => 4 * ``` */ size: () => Size; /** * Returns `true` if the object is an empty object. An object is considered empty unless it’s an arguments object, array, or * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. * * @example * ```typescript * ex({}).isEmpty(); // => true * ex({ a: 1 }).isEmpty(); // => false * ex([1, 2, 3]).isEmpty(); // => false * ex([]).isEmpty(); // => true * ex(new Map()).isEmpty(); // => true * ex(new Set()).isEmpty(); // => true * ``` */ isEmpty: () => boolean; /** * Calls a defined callback function on each enumerable key/value pair of the object, and returns an object that contains the results. * @param callbackfn A function that accepts up to three arguments. The map function calls the callbackfn function one time for each key/value pair in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).map(([key, value]) => [`${key}_`, value * 2]); // => { '5_': 84, 'a_': 2, 'b_': 4 } * const mapped = ex(obj).map(([key, value]) => [`${key}_`, value * 2]); // mapped :: { '5_': number, 'a_': number, 'b_': number } * ``` */ map: ( callbackfn: ( entry: StrictEntries[number], index: number, object: O, ) => R, thisArg?: any, ) => ExtendedObject<{ [P in R[0]]: R[1]; }>; /** * Calls a defined callback function on each enumerable key of the object, and returns an object that contains the results. * @param callbackfn A function that accepts up to three arguments. The mapKeys function calls the callbackfn function one time for each key in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).mapKey((key) => `${key}_`); // => { '5_': 42, 'a_': 1, 'b_': 2 } * const mapped = ex(obj).mapKeys((key) => `${key}_`); // mapped :: { '5_': number, 'a_': number, 'b_': number } * ``` */ mapKeys: ( callbackfn: (key: StrictKeys[number], index: number, object: O) => R, thisArg?: any, ) => ExtendedObject<{ [P in R]: StrictValues[number]; }>; /** * Calls a defined callback function on each enumerable value of the object, and returns an object that contains the results. * @param callbackfn A function that accepts up to three arguments. The mapValues function calls the callbackfn function one time for each value in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).mapValues((value) => value * 2); // => { '5': 84, 'a': 2, 'b': 4 } * const mapped = ex(obj).mapValues((value) => value * 2); // mapped :: { '5': number, 'a': number, 'b': number } * ``` */ mapValues: ( callbackfn: (value: StrictValues[number], index: number, object: O) => R, thisArg?: any, ) => ExtendedObject<{ [P in StrictKeys[number]]: R; }>; /** * Calls a defined callback function on each enumerable key/value pair of the object, and returns an object that contains results meeting the condition specified in the callback function. * @param predicate A function that accepts up to three arguments. The filter function calls the predicate function one time for each key/value pair in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * ex(obj).filter(([key, value]) => key === 'a' || value === 42); // => { 5: 42, a: 1 } * const filtered = ex(obj).filter(([key, value]) => key === 'a' || value === 42); // filtered :: { 5?: number | undefined, a?: number | undefined, b?: number | undefined } * ``` */ filter: ( predicate: ( entry: StrictEntries[number], index: number, object: O, ) => boolean, thisArg?: any, ) => ExtendedObject<{ [P in StrictKeys[number]]?: O[P]; }>; /** * Calls a defined callback function on each enumerable key/value pair of the object. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce function calls the callbackfn function one time for each key/value pair in the object. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an object value. * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3 }; * ex(obj).reduce((acc, [key, value]) => acc + value, 0); // => 6 * ``` */ reduce: { ( callbackfn: ( previousValue: StrictValues[number], currentEntry: StrictEntries[number], currentIndex: number, object: O, ) => StrictValues[number], ): StrictValues[number]; ( callbackfn: ( previousValue: R, currentEntry: StrictEntries[number], currentIndex: number, object: O, ) => R, initialValue: R, ): R; }; /** * Returns an object composed of the own and inherited enumerable properties of the object that are not omitted. * @param keys The property names or paths to omit. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [3, 4, 5] }, e: 6 }; * ex(obj).omit('a', 'b'); // => { c: { d: [3, 4, 5] }, e: 6 } * ex(obj).omit(path('c.d')); // => { a: 1, b: 2, c: {}, e: 6 } * ex(obj).omit(prop('e'), 'a', path('c.d[1]')); // => { b: 2, c: { d: [3, 5] } } * ``` */ omit: < const P extends keyof O | typeof omitPropFallback, const PP extends BasePath | BasePathArray = never, >( ...keys: readonly (P | PropFn | PathFn)[] ) => ExtendedObject< [PP] extends [never] ? typeof omitPropFallback extends P ? O : Omit : OmitByPath, PP> >; /** * Returns an object composed of keys generated from the results of running each element of the object through `fn`. * The corresponding value of each key is an array of the elements responsible for generating the key. * @param fn Prop, Path, a property name or a function that accepts up to three arguments. The groupBy function calls the fn function one time for each key/value pair in the object. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42 }; * const obj2 = { a: { value: 1, nested: { v: 1 } }, b: { value: 2, nested: { v: 2 } }, c: { value: 2, nested: { v: 3 } } }; * ex(obj).groupBy(([, value]) => value % 2 === 0 ? 'even' : 'odd'); // => { odd: [1], even: [42, 2] } * ex(obj2).groupBy('value'); // => { 1: [{ value: 1, nested: { v: 1 } }], 2: [{ value: 2, nested: { v: 2 } }, { value: 2, nested: { v: 3 } }] } * ex(obj2).groupBy(prop('value')); // => { 1: [{ value: 1, nested: { v: 1 } }], 2: [{ value: 2, nested: { v: 2 } }, { value: 2, nested: { v: 3 } }] } * ex(obj2).groupBy(path('nested.v')); // => { 1: [{ value: 1, nested: { v: 1 } }], 2: [{ value: 2, nested: { v: 2 } }], 3: [{ value: 2, nested: { v: 3 } }] } * ``` */ groupBy: { < const K extends { [P in keyof O[keyof O]]: O[keyof O][P] extends PropertyKey ? P : never; }[keyof O[keyof O]], const PP extends BasePath | BasePathArray = never, >( fn: K | PropFn | PathFn, ): ExtendedObject< ListOf['length'] extends 1 ? { [P in Cast]: O[keyof O]; } : GetByPath extends PropertyKey ? { [P in Cast, PropertyKey>]: O[keyof O]; } : never >; ( fn: (entry: StrictEntries[number], index: number, object: O) => R, ): ExtendedObject<{ [P in R]: O[keyof O]; }>; }; with: { /** * Returns a new object with the specified property set to the given value. * @param prop Property name or `prop` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).with('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).with(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ < const K extends { [P in keyof O]: O[P] extends PropertyKey ? P : never; }[keyof O], >( prop: K | PropFn, value: O[K], ): ExtendedObject; /** * Returns a new object with the specified property set to the given value. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).with('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).with(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ | BasePathArray>( path: PathFn, value: Obj.Get extends List ? Path : never>, ): ExtendedObject; /** * Returns a new object with the specified property set to the given value. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).with('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).with(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).with(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ >( path: PP, value: Obj.Get extends List ? Path : never>, ): ExtendedObject; }; withW: { /** * Returns a new object with the specified property set to the given value. * * It is the same as `ExtendedObject#with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param prop Property name or `prop` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).withW('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).withW(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link ExtendedObject#with} */ ( prop: K | PropFn, value: V, ): Obj.With>; /** * Returns a new object with the specified property set to the given value. * * It is the same as `ExtendedObject#with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).withW('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).withW(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link ExtendedObject#with} */ ( path: PathFn, value: V, ): Obj.With, Obj.WritableDeep>; /** * Returns a new object with the specified property set to the given value. * * It is the same as `ExtendedObject#with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * ex(obj).withW('a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * ex(obj).withW(path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ex(obj).withW(['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link ExtendedObject#with} */ ( path: PP, value: V, ): Obj.With, Obj.WritableDeep>; }; }; type Extends = T extends U ? True : False; type False = false; type Falsy_2 = null | undefined | false | '' | 0 | 0n; type Falsy_3 = false | 0 | 0n | '' | null | undefined; type Falsy_4 = false | 0 | 0n | '' | null | undefined; type First = number extends AS['length'] ? AS[0] | undefined : AS[0]; interface Flow2 extends HKT1 { new: (x: Assume) => Apply1>; } interface FormatCurrencyOptions extends FormatRoundedOptions { /** * @default ',' */ delimiter?: string; /** * @default '%u%n' */ format?: string; /** * @default '-%u%n' */ negativeFormat?: string; /** * Unit of the currency, depending on the locale by default. * @example '$' */ unit?: string; /** * @default 2 */ precision?: number; locale?: Locale_2; } interface FormatDelimitedOptions { /** * @default '.' */ separator?: string; /** * @default ',' */ delimiter?: string; /** * @default 3 */ groupSize?: number; /** * Pattern used to match the number. * If provided, `groupSize` will be ignored. * @default /(\d)(?=(\d{})+(?!\d))/g */ pattern?: RegExp; } interface FormatHumanSizeOptions extends FormatRoundedOptions { /** * @default '' */ delimiter?: string; /** * @default '%n %u' */ format?: string; units?: { /** * Representation of the unit depending on the locale. * @example 'Bytes' */ byte: string; /** * Representation of the unit depending on the locale. * @example 'KB' */ kb: string; /** * Representation of the unit depending on the locale. * @example 'MB' */ mb: string; /** * Representation of the unit depending on the locale. * @example 'GB' */ gb: string; /** * Representation of the unit depending on the locale. * @example 'TB' */ tb: string; /** * Representation of the unit depending on the locale. * @example 'PB' */ pb: string; /** * Representation of the unit depending on the locale. * @example 'EB' */ eb: string; }; /** * @default true */ significant?: boolean; /** * @default true */ stripInsignificantZeros?: boolean; locale?: Locale_2; } interface FormatPercentageOptions extends FormatRoundedOptions { /** * @default '%n%' */ format?: string; /** * @default '' */ delimiter?: string; } interface FormatPhoneOptions { areaCode?: boolean; countryCode?: string | number; delimiter?: string; extension?: string | number; pattern?: RegExp; locale?: Locale_2; } interface FormatRoundedOptions extends FormatDelimitedOptions { /** * @default '' */ delimiter?: string; /** * @default 3 */ precision?: number; /** * @default false */ significant?: boolean; /** * @default false */ stripInsignificantZeros?: boolean; /** * @default 'half_up' */ roundMode?: | 'up' | 'down' | 'half_up' | 'half_down' | 'half_even' | 'ceil' | 'floor'; } type GeneralizeNumeric = number extends N ? N : bigint extends N ? N : N extends number ? number : bigint; type GeneralizeNumeric_2 = number extends N ? N : bigint extends N ? N : N extends number ? number : bigint; type GeneralizeNumeric_3 = number extends N ? N : bigint extends N ? N : N extends number ? number : bigint; type GenericFunction = (...x: never[]) => unknown; type GetByPath = _GetByPath< Distribute<[O]>[0], P extends string ? ParsePath

: P extends readonly string[] ? P : never >; type _GetByPath = P extends readonly [] ? O : P extends readonly [infer L, ...infer R] ? undefined extends O ? __GetByPath, L, R> | undefined : __GetByPath : undefined; type HasOnlyBigIntAndHaltAtNonNumeric = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends bigint ? true : false : THead extends bigint ? HasOnlyBigIntAndHaltAtNonNumeric extends true ? true : false : false : never; type HasOnlyBigIntAndHaltAtNonNumeric_2 = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends bigint ? true : false : THead extends bigint ? HasOnlyBigIntAndHaltAtNonNumeric_2 extends true ? true : false : false : never; type HasOnlyBigIntAndHaltAtNonNumeric_3 = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends bigint ? true : false : THead extends bigint ? HasOnlyBigIntAndHaltAtNonNumeric_3 extends true ? true : false : false : never; type HasOnlyNumberAndHaltAtNonNumeric = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends number ? true : false : THead extends number ? HasOnlyNumberAndHaltAtNonNumeric extends true ? true : false : false : never; type HasOnlyNumberAndHaltAtNonNumeric_2 = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends number ? true : false : THead extends number ? HasOnlyNumberAndHaltAtNonNumeric_2 extends true ? true : false : false : never; type HasOnlyNumberAndHaltAtNonNumeric_3 = AS extends readonly [infer THead, ...infer TTail] ? TTail extends [] ? THead extends number ? true : false : THead extends number ? HasOnlyNumberAndHaltAtNonNumeric_3 extends true ? true : false : false : never; type HasOnlyNumberOrBigInt = [ HasOnlyNumberAndHaltAtNonNumeric, HasOnlyBigIntAndHaltAtNonNumeric, ] extends [true, false] ? true : [ HasOnlyNumberAndHaltAtNonNumeric, HasOnlyBigIntAndHaltAtNonNumeric, ] extends [false, true] ? true : false; type HasOnlyNumberOrBigInt_2 = [ HasOnlyNumberAndHaltAtNonNumeric_2, HasOnlyBigIntAndHaltAtNonNumeric_2, ] extends [true, false] ? true : [ HasOnlyNumberAndHaltAtNonNumeric_2, HasOnlyBigIntAndHaltAtNonNumeric_2, ] extends [false, true] ? true : false; type HasOnlyNumberOrBigInt_3 = [ HasOnlyNumberAndHaltAtNonNumeric_3, HasOnlyBigIntAndHaltAtNonNumeric_3, ] extends [true, false] ? true : [ HasOnlyNumberAndHaltAtNonNumeric_3, HasOnlyBigIntAndHaltAtNonNumeric_3, ] extends [false, true] ? true : false; declare abstract class HKT1 { readonly _1?: unknown; new: GenericFunction; } declare abstract class HKT2 { readonly _1?: unknown; readonly _2?: unknown; new: GenericFunction; } declare abstract class HKT3 { readonly _1?: unknown; readonly _2?: unknown; readonly _3?: unknown; new: GenericFunction; } declare abstract class HKT4 { readonly _1?: unknown; readonly _2?: unknown; readonly _3?: unknown; readonly _4?: unknown; new: GenericFunction; } interface Identity$ extends HKT1 { new: (x: Assume) => Identity; } type Identity = T; type If = Cond extends True ? Then : Else; type Ifp< T, Pred extends HKT1, ThenFn extends HKT1, ElseFn extends HKT1, > = Apply1 extends True ? Apply1 : Apply1; interface IfpList$ extends HKT1 { new: (x: Assume) => IfpList; } type IfpList = Ifp< T, IsList$, ThenFn, ElseFn >; type IncMap = { __: number; '-100': -99; '-99': -98; '-98': -97; '-97': -96; '-96': -95; '-95': -94; '-94': -93; '-93': -92; '-92': -91; '-91': -90; '-90': -89; '-89': -88; '-88': -87; '-87': -86; '-86': -85; '-85': -84; '-84': -83; '-83': -82; '-82': -81; '-81': -80; '-80': -79; '-79': -78; '-78': -77; '-77': -76; '-76': -75; '-75': -74; '-74': -73; '-73': -72; '-72': -71; '-71': -70; '-70': -69; '-69': -68; '-68': -67; '-67': -66; '-66': -65; '-65': -64; '-64': -63; '-63': -62; '-62': -61; '-61': -60; '-60': -59; '-59': -58; '-58': -57; '-57': -56; '-56': -55; '-55': -54; '-54': -53; '-53': -52; '-52': -51; '-51': -50; '-50': -49; '-49': -48; '-48': -47; '-47': -46; '-46': -45; '-45': -44; '-44': -43; '-43': -42; '-42': -41; '-41': -40; '-40': -39; '-39': -38; '-38': -37; '-37': -36; '-36': -35; '-35': -34; '-34': -33; '-33': -32; '-32': -31; '-31': -30; '-30': -29; '-29': -28; '-28': -27; '-27': -26; '-26': -25; '-25': -24; '-24': -23; '-23': -22; '-22': -21; '-21': -20; '-20': -19; '-19': -18; '-18': -17; '-17': -16; '-16': -15; '-15': -14; '-14': -13; '-13': -12; '-12': -11; '-11': -10; '-10': -9; '-9': -8; '-8': -7; '-7': -6; '-6': -5; '-5': -4; '-4': -3; '-3': -2; '-2': -1; '-1': 0; '0': 1; '1': 2; '2': 3; '3': 4; '4': 5; '5': 6; '6': 7; '7': 8; '8': 9; '9': 10; '10': 11; '11': 12; '12': 13; '13': 14; '14': 15; '15': 16; '16': 17; '17': 18; '18': 19; '19': 20; '20': 21; '21': 22; '22': 23; '23': 24; '24': 25; '25': 26; '26': 27; '27': 28; '28': 29; '29': 30; '30': 31; '31': 32; '32': 33; '33': 34; '34': 35; '35': 36; '36': 37; '37': 38; '38': 39; '39': 40; '40': 41; '41': 42; '42': 43; '43': 44; '44': 45; '45': 46; '46': 47; '47': 48; '48': 49; '49': 50; '50': 51; '51': 52; '52': 53; '53': 54; '54': 55; '55': 56; '56': 57; '57': 58; '58': 59; '59': 60; '60': 61; '61': 62; '62': 63; '63': 64; '64': 65; '65': 66; '66': 67; '67': 68; '68': 69; '69': 70; '70': 71; '71': 72; '72': 73; '73': 74; '74': 75; '75': 76; '76': 77; '77': 78; '78': 79; '79': 80; '80': 81; '81': 82; '82': 83; '83': 84; '84': 85; '85': 86; '86': 87; '87': 88; '88': 89; '89': 90; '90': 91; '91': 92; '92': 93; '93': 94; '94': 95; '95': 96; '96': 97; '97': 98; '98': 99; '99': 100; }; type InstanceType_2 = C extends new (...args: unknown[]) => infer T ? T : C extends StringConstructor ? string : C extends NumberConstructor ? number : C extends BooleanConstructor ? boolean : C extends SymbolConstructor ? symbol : C extends BigIntConstructor ? bigint : never; type Int = number; declare namespace Int { type Of = T extends Int ? T : T extends keyof IntMap ? IntMap[T] : T extends `${number}` ? IntMap['__'] : never; interface Of$ extends HKT1 { new: (n: Assume) => Of; } type Abs = Num.isNeg extends true ? `${N}` extends keyof AbsMap ? AbsMap[`${N}`] : AbsMap['__'] : N; interface Abs$ extends HKT1 { new: (n: Assume) => Abs; } type Inc = N extends Int ? `${N}` extends keyof IncMap ? IncMap[`${N}`] : IncMap['__'] : `${N}` extends keyof IncMap ? `${IncMap[`${N}`]}` : `${IncMap['__']}`; interface Inc$ extends HKT1 { new: (n: Assume) => Inc; } type Dec = N extends Int ? `${N}` extends keyof DecMap ? DecMap[`${N}`] : DecMap['__'] : `${N}` extends keyof DecMap ? `${DecMap[`${N}`]}` : `${DecMap['__']}`; interface Dec$ extends HKT1 { new: (n: Assume) => Dec; } type Add = N extends 0 ? M : M extends 0 ? N : And2, Num.isNeg> extends true ? Sub> : Add, Dec>; interface Add$ extends HKT1 { new: (n: Assume) => Add; } interface Add$$ extends HKT2 { new: ( n: Assume, m: Assume, ) => Add; } type Sub = M extends 0 ? N : Num.isNeg extends true ? Add> : Sub, Dec>; interface Sub$ extends HKT1 { new: (n: Assume) => Sub; } } type IntersectOf = (U extends unknown ? (k: U) => void : never) extends ( k: infer I, ) => void ? I : never; type IntMap = { __: number; '-100': -100; '-99': -99; '-98': -98; '-97': -97; '-96': -96; '-95': -95; '-94': -94; '-93': -93; '-92': -92; '-91': -91; '-90': -90; '-89': -89; '-88': -88; '-87': -87; '-86': -86; '-85': -85; '-84': -84; '-83': -83; '-82': -82; '-81': -81; '-80': -80; '-79': -79; '-78': -78; '-77': -77; '-76': -76; '-75': -75; '-74': -74; '-73': -73; '-72': -72; '-71': -71; '-70': -70; '-69': -69; '-68': -68; '-67': -67; '-66': -66; '-65': -65; '-64': -64; '-63': -63; '-62': -62; '-61': -61; '-60': -60; '-59': -59; '-58': -58; '-57': -57; '-56': -56; '-55': -55; '-54': -54; '-53': -53; '-52': -52; '-51': -51; '-50': -50; '-49': -49; '-48': -48; '-47': -47; '-46': -46; '-45': -45; '-44': -44; '-43': -43; '-42': -42; '-41': -41; '-40': -40; '-39': -39; '-38': -38; '-37': -37; '-36': -36; '-35': -35; '-34': -34; '-33': -33; '-32': -32; '-31': -31; '-30': -30; '-29': -29; '-28': -28; '-27': -27; '-26': -26; '-25': -25; '-24': -24; '-23': -23; '-22': -22; '-21': -21; '-20': -20; '-19': -19; '-18': -18; '-17': -17; '-16': -16; '-15': -15; '-14': -14; '-13': -13; '-12': -12; '-11': -11; '-10': -10; '-9': -9; '-8': -8; '-7': -7; '-6': -6; '-5': -5; '-4': -4; '-3': -3; '-2': -2; '-1': -1; '0': 0; '1': 1; '2': 2; '3': 3; '4': 4; '5': 5; '6': 6; '7': 7; '8': 8; '9': 9; '10': 10; '11': 11; '12': 12; '13': 13; '14': 14; '15': 15; '16': 16; '17': 17; '18': 18; '19': 19; '20': 20; '21': 21; '22': 22; '23': 23; '24': 24; '25': 25; '26': 26; '27': 27; '28': 28; '29': 29; '30': 30; '31': 31; '32': 32; '33': 33; '34': 34; '35': 35; '36': 36; '37': 37; '38': 38; '39': 39; '40': 40; '41': 41; '42': 42; '43': 43; '44': 44; '45': 45; '46': 46; '47': 47; '48': 48; '49': 49; '50': 50; '51': 51; '52': 52; '53': 53; '54': 54; '55': 55; '56': 56; '57': 57; '58': 58; '59': 59; '60': 60; '61': 61; '62': 62; '63': 63; '64': 64; '65': 65; '66': 66; '67': 67; '68': 68; '69': 69; '70': 70; '71': 71; '72': 72; '73': 73; '74': 74; '75': 75; '76': 76; '77': 77; '78': 78; '79': 79; '80': 80; '81': 81; '82': 82; '83': 83; '84': 84; '85': 85; '86': 86; '87': 87; '88': 88; '89': 89; '90': 90; '91': 91; '92': 92; '93': 93; '94': 94; '95': 95; '96': 96; '97': 97; '98': 98; '99': 99; '100': 100; }; type IsAny = boolean extends (T extends never ? true : false) ? true : false; type IsBooleanLiteral = LiteralCheck; type IsExact = ListOf['length'] extends 1 ? IsExactPrimitive extends true ? true : IsExactObject extends true ? true : IsExactArray extends true ? true : false : false; type IsExactArray = ListOf['length'] extends 1 ? AS extends readonly [infer AHead, ...infer ATail] ? IsExact extends true ? IsExactArray : false : AS extends [] ? true : false : false; type IsExactObject = ListOf['length'] extends 1 ? T extends object ? IsLiteral extends true ? { [P in keyof T]: IsExact extends true ? true : false; }[keyof T] extends true ? true : false : false : false : false; type IsExactPrimitive = ListOf['length'] extends 1 ? T extends Primitive_3 ? IsLiteral extends true ? true : T extends undefined | null | void ? true : false : false : false; type IsIdentifierName = `${S}` extends `${infer L}${infer R}` ? L extends Alphabet ? _IsIdentifierName : L extends '_' ? _IsIdentifierName : L extends '$' ? _IsIdentifierName : false : true; type _IsIdentifierName = `${S}` extends `${infer L}${infer R}` ? L extends ' ' | '\t' | '\n' | '\r' | '\v' | '\f' ? false : L extends `${number}` ? _IsIdentifierName : L extends '_' ? _IsIdentifierName : L extends '$' ? _IsIdentifierName : L extends Alphabet ? _IsIdentifierName : false : true; interface IsList$ extends HKT1 { new: (x: Assume) => IsList; } type IsList = T extends List ? Num extends T['length'] ? False : True : False; type IsLiteral = IsNotFalse>; type IsLiteralUnion = | IsStringLiteral | IsNumericLiteral | IsBooleanLiteral | IsSymbolLiteral; type IsNever = [T] extends [never] ? true : false; type IsNotFalse = [T] extends [false] ? false : true; type IsNumericLiteral = LiteralChecks; type IsStringLiteral = LiteralCheck; type IsSymbolLiteral = LiteralCheck; type KeepOnlyExact = AS extends readonly [ infer AHead, ...infer ATail, ] ? IsExact extends true ? [AHead, ...KeepOnlyExact] : KeepOnlyExact : []; type Last = IntersectOf void : never> extends ( x: infer P, ) => void ? P : never; type Last_2 = number extends AS['length'] ? AS[0] | undefined : AS extends [] | readonly [] ? undefined : AS[Dec]; type List = readonly T[]; export declare namespace List { export type Empty = readonly []; export type ToWritable = [...AS]; export interface ToWritable$ extends HKT1 { new: (as: Assume) => ToWritable; } export type ToReadonly = readonly [...AS]; export interface ToReadonly$ extends HKT1 { new: (as: Assume) => ToReadonly; } export type Of1 = readonly [A]; export interface Of1$ extends HKT1 { new: (a: Assume) => Of1; } export type Of2 = readonly [A, B]; export interface Of2$ extends HKT1 { new: (a: Assume) => Of2; } export interface Of2$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of2; } export type Of3 = readonly [A, B, C]; export interface Of3$ extends HKT1 { new: (a: Assume) => Of3; } export interface Of3$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of3; } export interface Of3$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of3; } export type Of4 = readonly [A, B, C, D]; export interface Of4$ extends HKT1 { new: (a: Assume) => Of4; } export interface Of4$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of4; } export interface Of4$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of4; } export type Of5 = readonly [A, B, C, D, E]; export interface Of5$ extends HKT1 { new: (a: Assume) => Of5; } export interface Of5$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of5; } export interface Of5$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of5; } export type Of6 = readonly [A, B, C, D, E, F]; export interface Of6$ extends HKT1 { new: (a: Assume) => Of6; } export interface Of6$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of6; } export interface Of6$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of6; } export type Of7 = readonly [A, B, C, D, E, F, G]; export interface Of7$ extends HKT1 { new: (a: Assume) => Of7; } export interface Of7$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of7; } export interface Of7$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of7; } export type Of8 = readonly [A, B, C, D, E, F, G, H]; export interface Of8$ extends HKT1 { new: (a: Assume) => Of8; } export interface Of8$$ extends HKT2 { new: ( a: Assume, b: Assume, ) => Of8; } export interface Of8$$$ extends HKT3 { new: ( a: Assume, b: Assume, c: Assume, ) => Of8; } export type Map = { [P in keyof AS]: Apply1; }; export interface Map$ extends HKT1 { new: (as: Assume) => Map; } export interface Map$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Map; } export type FlatMap = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? readonly [...Apply1, ...FlatMap] : readonly [] >; export interface FlatMap$ extends HKT1 { new: (as: Assume) => FlatMap; } export interface FlatMap$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => FlatMap; } export type Filter = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? Apply1 extends True ? readonly [Head, ...Filter] : Filter, F> : readonly [] >; export interface Filter$ extends HKT1 { new: (as: Assume) => Filter; } export interface Filter$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Filter; } export type Reject = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? Apply1 extends True ? Reject, F> : readonly [Head, ...Reject] : readonly [] >; export interface Reject$ extends HKT1 { new: (as: Assume) => Reject; } export interface Reject$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Reject; } export type Reduce = AS extends readonly [ infer Head, ...infer Tail, ] ? Reduce> : Z; export interface Reduce$ extends HKT1 { new: (as: Assume) => Reduce; } export interface Reduce$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Reduce; } export type Append = Apply1< Ary.IfReadonly, [...AS, T] >; export interface Append$ extends HKT1 { new: (as: Assume) => Append; } export interface Append$$ extends HKT2 { new: ( as: Assume, x: Assume, ) => Append; } export type Prepend = Apply1< Ary.IfReadonly, [T, ...AS] >; export interface Prepend$ extends HKT1 { new: (as: Assume) => Prepend; } export interface Prepend$$ extends HKT2 { new: ( as: Assume, x: Assume, ) => Prepend; } export type Concat = Apply1< Ary.IfReadonly, [...AS, ...BS] >; export interface Concat$ extends HKT1 { new: (as: Assume) => Concat; } export interface Concat$$ extends HKT2 { new: ( as: Assume, bs: Assume, ) => Concat; } export type Take = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? N extends 0 ? readonly [] : readonly [Head, ...Take>] : readonly [] >; export interface Take$ extends HKT1 { new: (as: Assume) => Take; } export interface Take$$ extends HKT2 { new: ( as: Assume, n: Assume, ) => Take; } export type TakeUntil = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? Apply1 extends True ? readonly [] : readonly [Head, ...TakeUntil] : readonly [] >; export interface TakeUntil$ extends HKT1 { new: (as: Assume) => TakeUntil; } export interface TakeUntil$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => TakeUntil; } export type Drop = Apply1< Ary.IfReadonly, AS extends readonly [unknown, ...infer Tail] ? N extends 0 ? AS : Drop> : [] >; export interface Drop$ extends HKT1 { new: (as: Assume) => Drop; } export interface Drop$$ extends HKT2 { new: ( as: Assume, n: Assume, ) => Drop; } export type DropIndex = Apply1< Ary.IfWritable, I extends 0 ? AS extends readonly [unknown, ...infer Tail] ? ToReadonly : AS : AS extends readonly [infer Head, ...infer Tail] ? readonly [Head, ...DropIndex>] : AS >; export interface DropIndex$ extends HKT1 { new: (as: Assume) => DropIndex; } export interface DropIndex$$ extends HKT2 { new: ( as: Assume, i: Assume, ) => DropIndex; } export type DropUntil = Apply1< Ary.IfReadonly, AS extends readonly [infer Head, ...infer Tail] ? Apply1 extends True ? AS : DropUntil : [] >; export interface DropUntil$ extends HKT1 { new: (as: Assume) => DropUntil; } export interface DropUntil$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => DropUntil; } export type Every = AS extends readonly [ infer Head, ...infer Tail, ] ? Apply1 extends True ? Every : False : True; export interface Every$ extends HKT1 { new: (as: Assume) => Every; } export interface Every$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Every; } export type NoneMatch = AS extends readonly [ infer Head, ...infer Tail, ] ? Apply1 extends True ? False : NoneMatch : True; export interface NoneMatch$ extends HKT1 { new: (as: Assume) => NoneMatch; } export interface NoneMatch$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => NoneMatch; } export type Some = AS extends readonly [ infer Head, ...infer Tail, ] ? Apply1 extends True ? True : Apply1 | Some : False; export interface Some$ extends HKT1 { new: (as: Assume) => Some; } export interface Some$$ extends HKT2 { new: ( as: Assume, f: Assume, ) => Some; } export type With = Apply1< Ary.IfWritable, AS extends readonly [infer Head, ...infer Tail] ? I extends 0 ? readonly [T, ...Tail] : readonly [Head, ...With, T>] : I extends -1 ? readonly [] : [...Repeat, T] >; export interface With$ extends HKT1 { new: (as: Assume) => With; } export interface With$$ extends HKT2 { new: ( as: Assume, i: Assume, ) => With; } export interface With$$$ extends HKT3 { new: ( as: Assume, i: Assume, x: Assume, ) => With; } export type Mutate = Apply1< Ary.IfReadonly, BS >; export interface Mutate$ extends HKT1 { new: (as: Assume) => Mutate; } export interface Mutate$$ extends HKT2 { new: ( as: Assume, bs: Assume, ) => Mutate; } export type Length = AS['length']; export interface Length$ extends HKT1 { new: (as: Assume) => Length; } export type Get = AS extends readonly [ infer Head extends AS[0], ...infer Tail, ] ? I extends 0 ? Head : Get> : never; export interface Get$ extends HKT1 { new: (as: Assume) => Get; } export interface Get$$ extends HKT2 { new: ( as: Assume, i: Assume, ) => Get; } export type Head = AS extends readonly [ infer Head extends AS[0], ...unknown[], ] ? Head : never; export interface Head$ extends HKT1 { new: (as: Assume) => Head; } } type List_2 = readonly any[]; type ListOf = _ListOf extends infer X ? Cast : never; type _ListOf> = { 0: _ListOf, [LastU, ...LN]>; 1: LN; }[[U] extends [never] ? 1 : 0]; type LiteralCheck = IsNever extends false ? [T] extends [LiteralType] ? [LiteralType] extends [T] ? false : true : false : false; type LiteralChecks = IsNotFalse< LiteralUnionType extends Primitive_3 ? LiteralCheck : never >; type Locale_2 = | 'en-US' | 'en-GB' | 'en-CA' | 'en-AU' | 'ja-JP' | 'ko-KR' | 'de-DE' | 'fr-FR' | 'es-ES' | 'it-IT' | 'pt-PT' | 'pt-BR' | 'nl-NL' | 'pl-PL' | 'ru-RU' | 'tr-TR' | 'ar-SA' | 'cs-CZ' | 'da-DK' | 'fi-FI' | 'el-GR' | 'he-IL' | 'hu-HU' | 'id-ID' | 'ms-MY' | 'no-NO' | 'ro-RO' | 'sk-SK' | 'sv-SE' | 'th-TH' | 'vi-VN' | 'uk-UA' | 'hi-IN' | 'bn-IN' | 'pa-IN' | 'ta-IN' | 'te-IN' | 'ml-IN' | 'mr-IN' | 'ur-IN' | 'or-IN' | 'gu-IN' | 'kn-IN' | 'as-IN' | 'ne-NP' | 'si-LK' | 'lo-LA' | 'my-MM' | 'km-KH' | 'ko-KP' | 'zh-CN' | 'zh-TW' | 'zh-HK' | 'zh-MO' | 'zh-SG' | (string & NonNullable); type Mean = AS extends [] | readonly [] ? 0 : HasOnlyNumberOrBigInt> extends true ? AS[number] extends number | bigint ? GeneralizeNumeric : never : never; type Median = AS extends [] | readonly [] ? never : HasOnlyNumberOrBigInt_2> extends true ? AS[number] extends number | bigint ? GeneralizeNumeric_2 : never : never; type MethodKey = IsAny extends true ? PropertyKey : [T] extends [never] ? never : T extends string ? | _MethodKey< string, ListOf< Exclude< keyof string, | 'capitalize' | 'isBlank' | 'isEmpty' | 'isNotBlank' | 'isNotEmpty' | 'reverse' | 'trimIndent' > > > | 'capitalize' | 'isBlank' | 'isEmpty' | 'isNotBlank' | 'isNotEmpty' | 'reverse' | 'trimIndent' : _MethodKey>; type _MethodKey = AS extends readonly [ infer A, ...infer B, ] ? A extends keyof T ? B extends readonly PropertyKey[] ? T[A] extends () => any ? _MethodKey | A : _MethodKey : never : never : never; type Nat = number; declare namespace Nat { type GT = N extends 0 ? false : M extends 0 ? true : GT, Int.Dec>; interface GT$ extends HKT1 { new: (n: Assume) => GT; } type GTE = N extends 0 ? M extends 0 ? true : false : M extends 0 ? true : GTE, Int.Dec>; interface GTE$ extends HKT1 { new: (n: Assume) => GTE; } type LT = N extends 0 ? M extends 0 ? false : true : M extends 0 ? false : LT, Int.Dec>; interface LT$ extends HKT1 { new: (n: Assume) => LT; } type LTE = N extends 0 ? true : M extends 0 ? false : LTE, Int.Dec>; interface LTE$ extends HKT1 { new: (n: Assume) => LTE; } } type Not = Bool.Not; type Nullish_2 = null | undefined; type Num = number; export declare namespace Num { export type IsPos = `${N}` extends `-${string}` ? False : True; export interface IsPos$ extends HKT1 { new: (n: Assume) => IsPos; } export type isNeg = `${N}` extends `-${string}` ? True : False; export interface IsNeg$ extends HKT1 { new: (n: Assume) => isNeg; } export type IsNat = T extends | string | number | bigint | boolean | null | undefined ? Pipe1, List.Every$> : False; export interface IsNat$ extends HKT1 { new: (x: Assume) => IsNat; } export type IfNat = If, Then, Else>; export interface IfNat$ extends HKT1 { new: (x: Assume) => IfNat; } export interface IfNat$$ extends HKT2 { new: ( x: Assume, then: Assume, ) => IfNat; } export interface IfNat$$$ extends HKT3 { new: ( x: Assume, then: Assume, else_: Assume, ) => IfNat; } } type Numeric = number | bigint; type Obj = object; export declare namespace Obj { export type KeyOf = keyof O; export interface KeyOf$ extends HKT1 { new: (o: Assume) => KeyOf; } export type KeyOfNullish = keyof Exclude; export interface KeyOfNullish$ extends HKT1 { new: (o: Assume) => KeyOfNullish; } export type WritableDeep = _Id<{ -readonly [K in keyof O]: O[K] extends object ? WritableDeep : O[K]; }>; export type ValueOf = O[keyof O]; export interface ValueOf$ extends HKT1 { new: (o: Assume) => ValueOf; } export type ValueOfNullish = Exclude[keyof Exclude< O, Nullish >]; export interface ValueOfNullish$ extends HKT1 { new: (o: Assume) => ValueOfNullish; } export type OptionalKeyOf = { [K in keyof O]-?: NonNullable extends { [P in K]: O[K]; } ? K : never; }[keyof O]; export interface OptionalKeyOf$ extends HKT1 { new: (o: Assume) => OptionalKeyOf; } export type _SpreadProperties = { [P in K]: L[P] | Exclude; }; export type _Id = T extends infer U ? { [K in keyof U]: U[K]; } : never; export type _SpreadTwo = _Id< Pick> & Pick>> & Pick, keyof L>> & _SpreadProperties & keyof L> >; export type Spread = AS extends [infer Head, ...infer Tail] ? _SpreadTwo> : unknown; export interface Spread$ extends HKT1 { new: (as: Assume) => Spread; } export type Merge1 = O1; export interface Merge1$ extends HKT1 { new: (o1: Assume) => Merge1; } export type Merge2 = _SpreadTwo; export interface Merge2$ extends HKT1 { new: (o1: Assume) => Merge2; } export interface Merge2$$ extends HKT2 { new: ( o1: Assume, o2: Assume, ) => Merge2; } export type Merge3 = _SpreadTwo<_SpreadTwo, O3>; export interface Merge3$ extends HKT1 { new: (o1: Assume) => Merge3; } export interface Merge3$$ extends HKT2 { new: ( o1: Assume, o2: Assume, ) => Merge3; } export interface Merge3$$$ extends HKT3 { new: ( o1: Assume, o2: Assume, o3: Assume, ) => Merge3; } export type BuildNested

, V> = P extends readonly [ infer Head, ...infer Tail, ] ? { [P in Head]: BuildNested; } : V; export interface BuildNested$ extends HKT1 { new: (p: Assume>) => BuildNested; } export interface BuildNested$$ extends HKT2 { new: ( p: Assume>, v: Assume, ) => BuildNested; } export type Get> = And2< Extends, Ary>, Num.IsNat > extends True ? Pipe1>, Ary.ElemOrUndefined$>> : K extends keyof Exclude ? Exclude[K] | Exclude> : K extends List ? Pipe1> : never; export interface Get$> extends HKT1 { new: (o: Assume) => Get; } export interface Get$$ extends HKT2 { new: ( o: Assume, k: Assume>, ) => Get; } export type KeyContains = Pipe2>; export interface KeyContains$ extends HKT1 { new: (o: Assume) => KeyContains; } export interface KeyContains$$ extends HKT2 { new: ( o: Assume, k: Assume, ) => KeyContains; } export type IfKeyContains = If< KeyContains, Then, Else >; export interface IfKeyContains$ extends HKT1 { new: ( o: Assume, ) => IfKeyContains; } export interface IfKeyContains$$ extends HKT2 { new: ( o: Assume, k: Assume, ) => IfKeyContains; } export interface IfKeyContains$$$ extends HKT3 { new: ( o: Assume, k: Assume, then: Assume, ) => IfKeyContains; } export interface IfKeyContains$$$$ extends HKT4 { new: ( o: Assume, k: Assume, then: Assume, else_: Assume, ) => IfKeyContains; } export type IfpKeyContains< O, K, ThenFn extends HKT1, ElseFn extends HKT1, > = KeyContains extends True ? Apply1 : Apply1; export interface IfpKeyContains$ extends HKT1 { new: ( o: Assume, ) => IfpKeyContains; } export interface IfpKeyContains$$ extends HKT2 { new: ( o: Assume, k: Assume, ) => IfpKeyContains; } export interface IfpKeyContains$$$ extends HKT3 { new: ( o: Assume, k: Assume, thenFn: Assume, ) => IfpKeyContains; } export interface IfpKeyContains$$$$ extends HKT4 { new: ( o: Assume, k: Assume, thenFn: Assume, elseFn: Assume, ) => IfpKeyContains; } export type OptionalKeyContains = Pipe2>; export interface OptionalKeyContains$ extends HKT1 { new: (o: Assume) => OptionalKeyContains; } export interface OptionalKeyContains$$ extends HKT2 { new: ( o: Assume, k: Assume, ) => OptionalKeyContains; } export type _Set = And2, Num.IsNat> extends True ? Pipe1, V>, Ary.Mix$>> : K extends PropertyKey ? O extends Ary ? O & { [P in K]: V; } : Merge2< O, { [P in K]: V; } > : O; export type _With__Step> = Ifp< O, KeyContains$>, Get$>, Yield1$<_With__GenerateDefault>> >; export type _With__GenerateDefault = Num.IfNat< K, [], NonNullable >; export type With< O, K extends PropertyKey | List, V, > = K extends PropertyKey ? _Set : K extends List ? K extends readonly [infer Head] ? _Set : K extends readonly [ infer Head extends PropertyKey, ...infer T extends List, ] ? List.ToReadonly extends infer Tail extends List ? And2, Num.IsNat> extends True ? IfpList< O, List.With$, With<_With__Step, Tail, V>>, Ary.Mutate$< And2< Extends, Tail, V>, object>, Extends, Obj> > extends True ? Merge2< Pipe1, With<_With__Step, Tail, V> > : Pipe1 | With<_With__Step, Tail, V> > > : O extends Ary ? O & If< OptionalKeyContains, { [P in Head]?: With>, Tail, V>; }, { [P in Head]: With<_With__Step, Tail, V>; } > : Ifp< O, OptionalKeyContains$, Flow2< Omit$, Merge2$<{ [P in Head]: Union2< With>, Tail, V>, With<_With__GenerateDefault>, Tail, V> >; }> >, Merge2$<{ [P in Head]: With<_With__Step, Tail, V>; }> > : never : O : never; export interface With$, V> extends HKT1 { new: (o: Assume) => With; } export interface With$$ extends HKT2 { new: ( o: Assume, k: Assume>, ) => With; } export interface With$$$ extends HKT3 { new: ( o: Assume, k: Assume>, v: Assume, ) => With; } export type Omit = { [P in Exclude]: O[P]; }; export interface Omit$ extends HKT1 { new: (o: Assume) => Omit; } export interface Omit$$ extends HKT2 { new: ( o: Assume, k: Assume, ) => Omit; } export type Union2 = _Id< { [K in keyof O1 & keyof O2]: If< And2, Extends>, Union2, O1[K] | O2[K] >; } & { [K in Exclude]?: O1[K]; } & { [K in Exclude]?: O2[K]; } >; export interface Union2$ extends HKT1 { new: (o1: Assume) => Union2; } export interface Union2$$ extends HKT2 { new: ( o1: Assume, o2: Assume, ) => Union2; } { } } type _Omit = T extends readonly unknown[] ? number extends T['length'] ? T : K extends keyof T ? K extends `${number}` ? List.DropIndex> : T : T : K extends keyof T ? Omit : T; type OmitByPath = _OmitByPath< Distribute<[O]>[0], P extends string ? ParsePath

: P extends readonly string[] ? P : never >; type _OmitByPath = P extends readonly [infer L] ? L extends keyof O ? _Omit : O : P extends readonly [infer L, ...infer R] ? undefined extends O ? L extends keyof Exclude ? | (_Omit, L> & { [K in L]: _OmitByPath[L], R>; }) | undefined : O : L extends keyof O ? _Omit & { [K in L]: _OmitByPath; } : O : never; declare const omitPropFallback: unique symbol; type Ord = string | number | boolean | Date; type ParsePath = _ParsePath; type _ParsePath< S extends string, TPrev extends string = '', TPrevChar extends string = '', TInString extends boolean = false, TStringQuote extends "'" | '"' = "'", TResult extends readonly string[] = [], > = S extends `${infer L}${infer R}` ? TInString extends true ? L extends '\\' ? TPrevChar extends '\\' ? _ParsePath : _ParsePath : L extends TStringQuote ? TPrevChar extends '\\' ? _ParsePath : _ParsePath> : _ParsePath : L extends "'" | '"' ? TPrevChar extends '[' ? _ParsePath : _ParsePath> : L extends '[' ? _ParsePath> : L extends ']' ? TPrevChar extends "'" | '"' ? _ParsePath : _ParsePath> : L extends '.' ? _ParsePath> : _ParsePath : AppendPrev; type _ParsePath_2< S extends Str, Prev extends Str = '', PrevChar extends Str = '', InString extends Bool = False, StringQuote extends "'" | '"' = "'", Result extends List = [], > = S extends `${infer L}${infer R}` ? InString extends True ? L extends '\\' ? PrevChar extends '\\' ? _ParsePath_2 : _ParsePath_2 : L extends StringQuote ? PrevChar extends '\\' ? _ParsePath_2 : _ParsePath_2> : _ParsePath_2 : L extends "'" | '"' ? PrevChar extends '[' ? _ParsePath_2 : _ParsePath_2> : L extends '[' ? _ParsePath_2> : L extends ']' ? PrevChar extends "'" | '"' ? _ParsePath_2 : _ParsePath_2> : L extends '.' ? _ParsePath_2> : _ParsePath_2 : _AppendPrev; declare global { const patch: (classType: C) => C extends | SymbolConstructor | BigIntConstructor | NumberConstructor | StringConstructor | BooleanConstructor | (new (...args: any[]) => any) ? { with: (namesAndValues: { [P in keyof InstanceType_2 as P extends 'valueOf' ? never : InstanceType_2[P] extends (...args: any[]) => unknown ? P : never]?: | (InstanceType_2[P] extends (...args: any[]) => unknown ? ( target: Unboxed>, ...args: Parameters[P]> ) => ReturnType[P]> : never) | undefined; }) => void; withGetter: (namesAndValues: { [P_1 in keyof InstanceType_2 as P_1 extends | 'toString' | 'toLocaleString' | 'valueOf' ? never : P_1]?: | ((target: Unboxed>) => InstanceType_2[P_1]) | undefined; }) => void; withStatic: (namesAndValues: { [P_2 in keyof C as P_2 extends | 'length' | 'name' | 'prototype' | 'caller' ? never : C[P_2] extends (...args: any[]) => unknown ? P_2 : never]?: C[P_2] | undefined; }) => void; } : Omit< { with: (namesAndValues: { [P in keyof InstanceType_2 as P extends 'valueOf' ? never : InstanceType_2[P] extends (...args: any[]) => unknown ? P : never]?: | (InstanceType_2[P] extends (...args: any[]) => unknown ? ( target: Unboxed>, ...args: Parameters[P]> ) => ReturnType[P]> : never) | undefined; }) => void; withGetter: (namesAndValues: { [P_1 in keyof InstanceType_2 as P_1 extends | 'toString' | 'toLocaleString' | 'valueOf' ? never : P_1]?: | ((target: Unboxed>) => InstanceType_2[P_1]) | undefined; }) => void; withStatic: (namesAndValues: { [P_2 in keyof C as P_2 extends | 'length' | 'name' | 'prototype' | 'caller' ? never : C[P_2] extends (...args: any[]) => unknown ? P_2 : never]?: C[P_2] | undefined; }) => void; }, 'with' | 'withGetter' >; } type Path = T extends Str ? List.ToReadonly<_ParsePath_2> : T; type PathExtension

= ( value: P extends BasePath | BasePathArray ? GetByPath : never, ) => (o: O) => boolean; type PathExtensions

= { /** * Returns `true` if the value of the path satisfies the predicate. * @param pred The predicate to satisfy. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').satisfies((value) => value > 1)); // => [{ a: { b: [4, 5, 6] } }] * ``` */ satisfies: ( pred: P extends BasePath | BasePathArray ? (value: GetByPath) => boolean : never, ) => (o: O) => boolean; /** * Returns `true` if the value of the path is equal to the given value (using `===`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').eq(1)); // => [{ a: { b: [1, 2, 3] } }] * ``` */ eq: PathExtension

; /** * Returns `true` if the value of the path is equal to the given value (using `===`). * * It is the same as `eq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').eqW(1)); // => [{ a: { b: [1, 2, 3] } }] * ``` */ eqW: PathExtensionW

; /** * Returns `true` if the value of the path is not equal to the given value (using `!==`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').notEq(1)); // => [{ a: { b: [4, 5, 6] } }] * ``` */ notEq: PathExtension

; /** * Returns `true` if the value of the path is not equal to the given value (using `!==`). * * It is the same as `notEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').notEqW(1)); // => [{ a: { b: [4, 5, 6] } }] * ``` */ notEqW: PathExtensionW

; /** * Returns `true` if the value of the path is loosely equal to the given value (using `==`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b[0]').looselyEq(1)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }] * ``` */ looselyEq: PathExtension

; /** * Returns `true` if the value of the path is loosely equal to the given value (using `==`). * * It is the same as `looselyEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b[0]').looselyEqW(1)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }] * ``` */ looselyEqW: PathExtensionW

; /** * Returns `true` if the value of the path is not loosely equal to the given value (using `!=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b[0]').notLooselyEq(1)); // => [] * ``` */ notLooselyEq: PathExtension

; /** * Returns `true` if the value of the path is not loosely equal to the given value (using `!=`). * * It is the same as `notLooselyEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b[0]').notLooselyEqW(1)); // => [] * ``` */ notLooselyEqW: PathExtensionW

; /** * Returns `true` if the value of the path is equal to the given value (using `equals`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b').equals([1, 2, 3])); // => [{ a: { b: [1, 2, 3] } }] * ``` * * @see {@link equals} */ equals: PathExtension

; /** * Returns `true` if the value of the path is equal to the given value (using `equals`). * * It is the same as `equals` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b').equalsW([1, 2, 3])); // => [{ a: { b: [1, 2, 3] } }] * ``` * * @see {@link equals} */ equalsW: PathExtensionW

; /** * Returns `true` if the value of the path is not equal to the given value (using `equals`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b').notEquals([1, 2, 3])); // => [{ a: { b: ['1', '2', '3'] } }] * ``` * * @see {@link equals} */ notEquals: PathExtension

; /** * Returns `true` if the value of the path is not equal to the given value (using `equals`). * * It is the same as `notEquals` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: ['1', '2', '3'] } }]; * objs.filter(path('a.b').notEqualsW([1, 2, 3])); // => [{ a: { b: ['1', '2', '3'] } }] * ``` * * @see {@link equals} */ notEqualsW: PathExtensionW

; /** * Returns `true` if the value of the path is greater than the given value (using `is`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [0, 2, 3] } }, { a: { b: [-0, 5, 6] } } * objs.filter(path('a.b[0]').is(-0)); // => [{ a: { b: [-0, 5, 6] } }] * ``` * * @see {@link is} */ is: PathExtension

; /** * Returns `true` if the value of the path is greater than the given value (using `is`). * * It is the same as `is` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [0, 2, 3] } }, { a: { b: [-0, 5, 6] } } * objs.filter(path('a.b[0]').isW(-0)); // => [{ a: { b: [-0, 5, 6] } }] * ``` * * @see {@link is} */ isW: PathExtensionW

; /** * Returns `true` if the value of the path is not equal to the given value (using `is`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [0, 2, 3] } }, { a: { b: [-0, 5, 6] } } * objs.filter(path('a.b[0]').isNot(-0)); // => [{ a: { b: [0, 2, 3] } }] * ``` * * @see {@link is} */ isNot: PathExtension

; /** * Returns `true` if the value of the path is not equal to the given value (using `is`). * * It is the same as `isNot` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [0, 2, 3] } }, { a: { b: [-0, 5, 6] } } * objs.filter(path('a.b[0]').isNotW(-0)); // => [{ a: { b: [0, 2, 3] } }] * ``` * * @see {@link is} */ isNotW: PathExtensionW

; /** * Returns `true` if the value of the path is greater than the given value (using `>`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').gt(1)); // => [{ a: { b: [4, 5, 6] } }] * ``` */ gt: PathExtension

; /** * Returns `true` if the value of the path is greater than the given value (using `>`). * * It is the same as `gt` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').gtW(1)); // => [{ a: { b: [4, 5, 6] } }] * ``` */ gtW: PathExtensionW

; /** * Returns `true` if the value of the path is greater than or equal to the given value (using `>=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').gte(1)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }] * ``` */ gte: PathExtension

; /** * Returns `true` if the value of the path is greater than or equal to the given value (using `>=`). * * It is the same as `gte` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').gteW(1)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }] * ``` */ gteW: PathExtensionW

; /** * Returns `true` if the value of the path is less than the given value (using `<`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').lt(4)); // => [{ a: { b: [1, 2, 3] } }] * ``` */ lt: PathExtension

; /** * Returns `true` if the value of the path is less than the given value (using `<`). * * It is the same as `lt` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').ltW(4)); // => [{ a: { b: [1, 2, 3] } }] * ``` */ ltW: PathExtensionW

; /** * Returns `true` if the value of the path is less than or equal to the given value (using `<=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').lte(4)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }] * ``` */ lte: PathExtension

; /** * Returns `true` if the value of the path is less than or equal to the given value (using `<=`). * * It is the same as `lte` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } } * objs.filter(path('a.b[0]').lteW(4)); // => [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }] * ``` */ lteW: PathExtensionW

; }; type PathExtensionW

= ( value: P extends BasePath | BasePathArray ? unknown : never, ) => (o: O) => boolean; type PathFn = (( o: O, ) => P extends BasePath | BasePathArray ? GetByPath : undefined) & PathExtensions

& { [zTag]: 'Path'; }; type Pipe1 = Apply1; type Pipe2 = Apply1>; type Primitive_2 = | string | number | boolean | bigint | symbol | undefined | null; type Primitive_3 = | string | number | bigint | boolean | symbol | null | undefined; type PropExtension

= ( value: P extends keyof T ? T[P] : never, ) => (o: T) => boolean; type PropExtensions

= { /** * Returns `true` if the value of the property satisfies the predicate. * @param pred The predicate to satisfy. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').satisfies((value) => value === 1)); // => [{ a: 1, b: 2 }] * ``` */ satisfies: ( pred: P extends keyof O ? (value: O[P]) => boolean : never, ) => (o: O) => boolean; /** * Returns `true` if the value of the property is equal to the specified value (using `===`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').eq(1)); // => [{ a: 1, b: 2 }] * ``` */ eq: PropExtension

; /** * Returns `true` if the value of the property is equal to the specified value (using `===`). * * It is the same as `eq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').eqW(1)); // => [{ a: 1, b: 2 }] * ``` */ eqW: PropExtensionW

; /** * Returns `true` if the value of the property is not equal to the specified value (using `!==`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').notEq(1)); // => [{ a: 3, b: 4 }] * ``` */ notEq: PropExtension

; /** * Returns `true` if the value of the property is not equal to the specified value (using `!==`). * * It is the same as `notEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').notEqW(1)); // => [{ a: 3, b: 4 }] * ``` */ notEqW: PropExtensionW

; /** * Returns `true` if the value of the property is loosely equal to the specified value (using `==`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: '1', b: 4 }]; * objs.filter(prop('a').looselyEq(1)); // => [{ a: 1, b: 2 }, { a: '1', b: 4 }] * ``` */ looselyEq: PropExtension

; /** * Returns `true` if the value of the property is loosely equal to the specified value (using `==`). * * It is the same as `looselyEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: '1', b: 4 }]; * objs.filter(prop('a').looselyEqW(1)); // => [{ a: 1, b: 2 }, { a: '1', b: 4 }] * ``` */ looselyEqW: PropExtensionW

; /** * Returns `true` if the value of the property is not loosely equal to the specified value (using `!=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: '1', b: 4 }]; * objs.filter(prop('a').notLooselyEq(1)); // => [] * ``` */ notLooselyEq: PropExtension

; /** * Returns `true` if the value of the property is not loosely equal to the specified value (using `!=`). * * It is the same as `notLooselyEq` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: '1', b: 4 }]; * objs.filter(prop('a').notLooselyEqW(1)); // => [] * ``` */ notLooselyEqW: PropExtensionW

; /** * Returns `true` if the value of the property is equal to the specified value (using `equals`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: 1 }, c: 2 }, { a: { b: 3 }, c: 4 }]; * objs.filter(prop('a').equals({ b: 1 })); // => [{ a: { b: 1 }, c: 2 }] * ``` * * @see {@link equals} */ equals: PropExtension

; /** * Returns `true` if the value of the property is equal to the specified value (using `equals`). * * It is the same as `equals` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: 1 }, c: 2 }, { a: { b: 3 }, c: 4 }]; * objs.filter(prop('a').equalsW({ b: 1 })); // => [{ a: { b: 1 }, c: 2 }] * ``` * * @see {@link equals} */ equalsW: PropExtensionW

; /** * Returns `true` if the value of the property is not equal to the specified value (using `equals`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: 1 }, c: 2 }, { a: { b: 3 }, c: 4 }]; * objs.filter(prop('a').notEquals({ b: 1 })); // => [{ a: { b: 3 }, c: 4 }] * ``` * * @see {@link equals} */ notEquals: PropExtension

; /** * Returns `true` if the value of the property is not equal to the specified value (using `equals`). * * It is the same as `notEquals` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: { b: 1 }, c: 2 }, { a: { b: 3 }, c: 4 }]; * objs.filter(prop('a').notEqualsW({ b: 1 })); // => [{ a: { b: 3 }, c: 4 }] * ``` * * @see {@link equals} */ notEqualsW: PropExtensionW

; /** * Returns `true` if the value of the property is the same as the specified value (using `is`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 0, c: 2 }, { a: -0, c: 4 }]; * objs.filter(prop('a').is(-0)); // => [{ a: -0, c: 4 }] * ``` * * @see {@link is} */ is: PropExtension

; /** * Returns `true` if the value of the property is the same as the specified value (using `is`). * * It is the same as `is` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 0, c: 2 }, { a: -0, c: 4 }]; * objs.filter(prop('a').isW(-0)); // => [{ a: -0, c: 4 }] * ``` * * @see {@link is} */ isW: PropExtensionW

; /** * Returns `true` if the value of the property is not the same as the specified value (using `is`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 0, c: 2 }, { a: -0, c: 4 }]; * objs.filter(prop('a').isNot(-0)); // => [{ a: 0, c: 2 }] * ``` * * @see {@link is} */ isNot: PropExtension

; /** * Returns `true` if the value of the property is not the same as the specified value (using `is`). * * It is the same as `isNot` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 0, c: 2 }, { a: -0, c: 4 }]; * objs.filter(prop('a').isNotW(-0)); // => [{ a: 0, c: 2 }] * ``` * * @see {@link is} */ isNotW: PropExtensionW

; /** * Returns `true` if the value of the property is greater than the specified value (using `>`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').gt(1)); // => [{ a: 3, b: 4 }] * ``` */ gt: PropExtension

; /** * Returns `true` if the value of the property is greater than the specified value (using `>`). * * It is the same as `gt` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').gtW(1)); // => [{ a: 3, b: 4 }] * ``` */ gtW: PropExtensionW

; /** * Returns `true` if the value of the property is greater than or equal to the specified value (using `>=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').gte(1)); // => [{ a: 1, b: 2 }, { a: 3, b: 4 }] * ``` */ gte: PropExtension

; /** * Returns `true` if the value of the property is greater than or equal to the specified value (using `>=`). * * It is the same as `gte` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').gteW(1)); // => [{ a: 1, b: 2 }, { a: 3, b: 4 }] * ``` */ gteW: PropExtensionW

; /** * Returns `true` if the value of the property is less than the specified value (using `<`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').lt(3)); // => [{ a: 1, b: 2 }] * ``` */ lt: PropExtension

; /** * Returns `true` if the value of the property is less than the specified value (using `<`). * * It is the same as `lt` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').ltW(3)); // => [{ a: 1, b: 2 }] * ``` */ ltW: PropExtensionW

; /** * Returns `true` if the value of the property is less than or equal to the specified value (using `<=`). * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').lte(3)); // => [{ a: 1, b: 2 }, { a: 3, b: 4 }] * ``` */ lte: PropExtension

; /** * Returns `true` if the value of the property is less than or equal to the specified value (using `<=`). * * It is the same as `lte` but the value is not checked at compile time. * The `W` postfix stands for "wide". * @param value The value to compare to. * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').lteW(3)); // => [{ a: 1, b: 2 }, { a: 3, b: 4 }] * ``` */ lteW: PropExtensionW

; }; type PropExtensionW

= ( value: P extends keyof T ? unknown : never, ) => (o: T) => boolean; type PropFn< T = any, P extends unknown extends T ? PropertyKey : keyof T = any, > = ((o: T) => P extends keyof T ? T[P] : undefined) & PropExtensions

& { [zTag]: 'Prop'; }; interface Range_2 extends ReadonlyArray { /** * Start of the range. */ readonly start: number; /** * End of the range (exclusive). */ readonly end: number; /** * Step size of the range. */ readonly step: number; /** * Gets or the length of the range. */ readonly length: number; readonly [Symbol.iterator]: () => IterableIterator; /** * Returns a range with the same start, end, and step. * * @example * ```typescript * const rg = range(2, 5, 2); * rg; // => 2..5 by 2 * rg.clone(); // => 2..5 by 2 * ``` */ readonly clone: () => this; /** * Convert the range to an array. * * @example * ```typescript * range(3).toArray(); // => [0, 1, 2] * range(2, 5).toArray(); // => [2, 3, 4] * range(2, 5, 2).toArray(); // => [2, 4] * range(5, 2, -1).toArray(); // => [5, 4, 3] * ``` */ readonly toArray: () => number[]; /** * Returns a string representation of the range. * * @example * ```typescript * range(3).toString(); // => '0..3' * range(2, 5).toString(); // => '2..5' * range(2, 5, 2).toString(); // => '2..5 by 2' * range(5, 2, -1).toString(); // => '5..2 by -1' * ``` */ readonly toString: () => string; } type RemoveTupleElementsByEquality< AS extends readonly unknown[], TS extends readonly unknown[], > = AS extends readonly [infer AHead, ...infer ATail] ? WillBeExcluded extends true ? RemoveTupleElementsByEquality : WillBeExcluded extends false ? [AHead, ...RemoveTupleElementsByEquality] : | RemoveTupleElementsByEquality | [AHead, ...RemoveTupleElementsByEquality] : []; type Repeat = number extends Int.Dec ? readonly T[] : N extends 0 ? readonly [] : readonly [T, ...Repeat>]; type Size = O extends { length: number; } ? O['length'] : O extends Map ? O['size'] : O extends Set ? O['size'] : string extends keyof O ? number : number extends keyof O ? number : symbol extends keyof O ? number : keyof O extends never ? 0 : ListOf['length']; type Str = string; declare namespace Str { type Empty = ''; type Of = T extends string | number | bigint | boolean | null | undefined ? `${T}` : never; interface Of$ extends HKT1 { new: (x: Assume) => Of; } type Repeat = N extends 0 ? Empty : N extends 1 ? S : `${S}${Repeat>}`; interface Repeat$ extends HKT1 { new: (s: Assume) => Repeat; } type ToChars = S extends `${infer Head}${infer Tail}` ? readonly [Head, ...ToChars] : readonly []; interface ToChars$ extends HKT1 { new: (s: Assume) => ToChars; } type IsDigit = S extends `${infer C}` ? C extends '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ? True : False : False; interface IsDigit$ extends HKT1 { new: (s: Assume) => IsDigit; } type IfDigit = If, Then, Else>; interface IfDigit$ extends HKT1 { new: (s: Assume) => IfDigit; } interface IfDigit$$ extends HKT2 { new: ( s: Assume, then: Assume, ) => IfDigit; } interface IfDigit$$$ extends HKT3 { new: ( s: Assume, then: Assume, else_: Assume, ) => IfDigit; } { } } type StrictEntries = keyof T extends symbol ? [] : string extends keyof T ? [`${Exclude}`, T[Exclude]][] : number extends keyof T ? [`${Exclude}`, T[Exclude]][] : _StrictEntries>[]; type _StrictEntries< T, TKeys extends readonly (string | number | symbol)[], > = TKeys extends [infer THead, ...infer TTail] ? THead extends keyof T ? TTail extends (string | number | symbol)[] ? THead extends symbol ? _StrictEntries : THead extends string ? [THead, T[THead]] | _StrictEntries : THead extends number ? [`${THead}`, T[THead]] | _StrictEntries : never : never : never : never; type StrictKeys = keyof T extends symbol ? [] : `${Exclude}`[]; type StrictValues = keyof T extends symbol ? [] : T[Exclude][]; type Sum = AS extends [] | readonly [] ? 0 : HasOnlyNumberOrBigInt_3> extends true ? AS[number] extends number | bigint ? GeneralizeNumeric_3 : never : never; type True = true; type Unboxed = T extends String ? string : T extends Number ? number : T extends Boolean ? boolean : T extends Symbol ? symbol : T extends BigInt ? bigint : T; type ValueOf = T[keyof T]; type WillBeExcluded = ExcludeBySequence< A, KeepOnlyExact > extends never ? true : A & TS[number] extends never ? false : boolean; type Without< AS extends readonly unknown[], BS extends readonly unknown[], > = number extends AS['length'] ? Array>> : RemoveTupleElementsByEquality; type Words = string extends S ? string[] : _Words; type _Words< S extends string, TTemp extends string = '', TLastIsBlank extends boolean = false, > = S extends `${infer THead}${infer TTail}` ? THead extends ' ' | '\n' | '\r' | '\t' ? _Words : TLastIsBlank extends true ? TTemp extends '' ? _Words : [TTemp, ..._Words] : _Words : [TTemp]; interface Yield1$ extends HKT1 { new: (x: Assume) => T; } declare const zTag: unique symbol; declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Clears the array in-place (set `length` to `0`). * * @example * ```typescript * const arr = [1, 2, 3]; * arr.clear(); * console.log(arr); // [] * ``` */ clear(): void; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns a new array with the same values. * It is an alias of `Array.from(this)`. * * @example * ```typescript * const arr = [1, 2, 3]; * const arr2 = arr.clone(); * console.log(arr2); // [1, 2, 3] * arr2[0] = 4; * console.log(arr2); // [4, 2, 3] * console.log(arr); // [1, 2, 3] * ``` */ clone(): this; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns a new array with the same values. * It is an alias of `Array.from(this)`. * * @example * ```typescript * const arr = [1, 2, 3]; * const arr2 = arr.clone(); * console.log(arr2); // [1, 2, 3] * arr2[0] = 4; * console.log(arr2); // [4, 2, 3] * console.log(arr); // [1, 2, 3] * ``` */ clone(): this; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns a new array without any falsy values. (i.e. `null`, `undefined`, `false`, `''`, `0`, `0n` or `NaN`) * * @example * ```typescript * const arr = [1, 2, undefined, 3, null, '', 0, false]; * arr.compact(); // => [1, 2, 3] * ``` */ compact(): Compact; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns a new array without any falsy values. (i.e. `null`, `undefined`, `false`, `''`, `0`, `0n` or `NaN`) * * @example * ```typescript * const arr = [1, 2, undefined, 3, null]; * arr.compact(); // => [1, 2, 3] * ``` */ compact(): Compact; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Determines whether the array contains a certain element, returning true or false as appropriate (using `Array#includes`). * * It is the same as `Array#includes`, but serves as a type guard in TS. * @param searchElement The element to search for. * @param fromIndex The position in this array at which to begin searching for searchElement. * * @example * ```typescript * list(1, 2, 3).contains(2); // => true * ['a', 'b', 'c'].contains('b'); // => true * ``` * * @example * ```typescript * const s = 'foo' as string; * if (list('bar', 'baz').contains(s)) { * const s2 = s; // s2 :: 'bar' | 'baz' * } * ``` * * @see {@link Array#includes} */ contains( this: AS, searchElement: unknown, fromIndex?: number, ): searchElement is AS[number]; } interface ReadonlyArray { /** * Determines whether the array contains a certain element, returning true or false as appropriate (using `Array#includes`). * * It is the same as `Array#includes`, but serves as a type guard in TS. * @param searchElement The element to search for. * @param fromIndex The position in this array at which to begin searching for searchElement. * * @example * ```typescript * list(1, 2, 3).contains(2); // => true * ['a', 'b', 'c'].contains('b'); // => true * ``` * * @example * ```typescript * const s = 'foo' as string; * if (list('bar', 'baz').contains(s)) { * const s2 = s; // s2 :: 'bar' | 'baz' * } * ``` * * @see {@link Array#includes} */ contains(searchElement: unknown, fromIndex?: number): searchElement is T; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns the count of elements from the array that satisfy the predicate. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 3, 5].count((x) => x === 3); // => 2 * [1, 2, 3, 3, 5].count((x) => x === 10); // => 0 * ``` */ count: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => number; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns the count of elements from the array that satisfy the predicate. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 3, 5].count((x) => x === 3); // => 2 * [1, 2, 3, 3, 5].count((x) => x === 10); // => 0 * ``` */ count: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => number; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Drops the first `count` elements from the array. * @param count - The number of elements to drop. * * @example * ```typescript * [1, 2, 3, 4, 5].drop(3); // => [4, 5] * [1, 2, 3, 4, 5].drop(0); // => [1, 2, 3, 4, 5] * [1, 2, 3, 4, 5].drop(10); // => [] * ``` */ drop: ( this: AS, count: N, ) => IfpList< AS, Num.IfNat, Ary.Mutate$>, Yield1$ >; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Drops the first `count` elements from the array. * @param count - The number of elements to drop. * * @example * ```typescript * [1, 2, 3, 4, 5].drop(3); // => [4, 5] * [1, 2, 3, 4, 5].drop(0); // => [1, 2, 3, 4, 5] * [1, 2, 3, 4, 5].drop(10); // => [] * ``` */ drop: ( this: AS, count: N, ) => IfpList< AS, Num.IfNat, Ary.Mutate$>, Yield1$ >; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Drops elements from the array until the predicate returns `true`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].dropUntil((x) => x === 3); // => [3, 4, 5] * [1, 2, 3, 4, 5].dropUntil((x) => x === 10); // => [] * ``` */ dropUntil: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Drops elements from the array until the predicate returns `true`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].dropUntil((x) => x === 3); // => [3, 4, 5] * [1, 2, 3, 4, 5].dropUntil((x) => x === 10); // => [] * ``` */ dropUntil: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Drops elements from the array until the predicate returns `false`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].dropWhile((x) => x < 3); // => [3, 4, 5] * [1, 2, 3, 4, 5].dropWhile((x) => x > 0); // => [1, 2, 3, 4, 5] * ``` */ dropWhile: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Drops elements from the array until the predicate returns `false`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].dropWhile((x) => x < 3); // => [3, 4, 5] * [1, 2, 3, 4, 5].dropWhile((x) => x > 0); // => [1, 2, 3, 4, 5] * ``` */ dropWhile: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } } declare global { interface Array { /** * The first element of the array. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.first; // => 1 * ``` */ // eslint-disable-next-line @typescript-eslint/no-explicit-any first: any[] extends this ? T | undefined : T; } interface ReadonlyArray { /** * The first element of the array. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.first; // => 1 * ``` */ first: T | undefined; } } declare global { interface Array { /** * Returns an object composed of keys generated from the results of running each element of the array through `fn`. * The corresponding value of each key is an array of the elements responsible for generating the key. * * @param fn Prop, Path, a property name or a function that accepts up to three arguments. The groupBy function calls the fn function one time for each element of the array. * * @example * ```typescript * const arr1 = [1, 2, 42]; * const arr2 = [{ v: 1, n: { v: 1 } }, { v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }]; * arr1.groupBy(value) => value % 2 === 0 ? 'even' : 'odd'); // => { odd: [1], even: [2, 42] } * arr2.groupBy('v'); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }] } * arr2.groupBy(prop('v')); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }] } * arr2.groupBy(path('n.v')); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }], 3: [{ v: 2, n: { v: 3 } }] } * ``` */ groupBy: { ( fn: (value: T, index: number, array: T[]) => R, ): { [P in R]: T[]; }; < const K extends { [P in keyof T]: T[P] extends PropertyKey ? P : never; }[keyof T], >( propertyName: K, ): { [P in Cast]: T[] }; }; } interface ReadonlyArray { /** * Returns an object composed of keys generated from the results of running each element of the array through `fn`. * The corresponding value of each key is an array of the elements responsible for generating the key. * * @param fn Prop, Path, a property name or a function that accepts up to three arguments. The groupBy function calls the fn function one time for each element of the array. * * @example * ```typescript * const arr1 = [1, 2, 42]; * const arr2 = [{ v: 1, n: { v: 1 } }, { v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }]; * arr1.groupBy(value) => value % 2 === 0 ? 'even' : 'odd'); // => { odd: [1], even: [2, 42] } * arr2.groupBy('v'); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }] } * arr2.groupBy(prop('v')); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }, { v: 2, n: { v: 3 } }] } * arr2.groupBy(path('n.v')); // => { 1: [{ v: 1, n: { v: 1 } }], 2: [{ v: 2, n: { v: 2 } }], 3: [{ v: 2, n: { v: 3 } }] } * ``` */ groupBy: { ( fn: (value: T, index: number, array: T[]) => R, ): { [P in R]: T[]; }; < const K extends { [P in keyof T]: T[P] extends PropertyKey ? P : never; }[keyof T], >( propertyName: K, ): { [P in Cast]: T[] }; }; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns `true` if length of the array is `0`. * * @example * ```typescript * [].isEmpty(); // => true * [1, 2, 3].isEmpty(); // => false * ``` */ isEmpty(this: AS): this is []; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns `true` if length of the array is `0`. * * @example * ```typescript * [].isEmpty(); // => true * [1, 2, 3].isEmpty(); // => false * ``` */ isEmpty(): this is readonly []; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns `true` if length of the array is greater than `0`. * * @example * ```typescript * [].isNotEmpty(); // => false * [1, 2, 3].isNotEmpty(); // => true * ``` */ isNotEmpty( this: AS, ): this is Exclude; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns `true` if length of the array is greater than `0`. * * @example * ```typescript * [].isNotEmpty(); // => false * [1, 2, 3].isNotEmpty(); // => true * ``` */ isNotEmpty(): this is Exclude; } } declare global { interface Array { /** * The last element of the array. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.last; // => 3 * ``` */ // eslint-disable-next-line @typescript-eslint/no-explicit-any last: any[] extends this ? T | undefined : T; } interface ReadonlyArray { /** * The last element of the array. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.last; // => 3 * ``` */ last: T | undefined; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns the mean of all elements in the array (only for number or bigint arrays). * * **Do not** use it with an array of bigint with zero elements, as it will return `0` instead of `0n`. * * @throws {TypeError} If the array contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [2, 1, 3.5, 3, 4]; * arr.mean(); // => 2.7 * ``` */ mean(): Mean; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns the mean of all elements in the array (only for number or bigint arrays). * * **Do not** use it with an array of bigint with zero elements, as it will return `0` instead of `0n`. * * @throws {TypeError} If the array contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [2, 1, 3.5, 3, 4]; * arr.mean(); // => 2.7 * ``` */ mean(): Mean; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns the median of all elements in the array (only for number or bigint arrays). * * If the array has an even number of elements, the median is the average of the two middle elements. * * @throws {TypeError} If the array is empty or contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [2, 1, 3.5, 3, 4]; * arr.median(); // => 3 * ``` */ median(): Median; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns the median of all elements in the array (only for number or bigint arrays). * * If the array has an even number of elements, the median is the average of the two middle elements. * * @throws {TypeError} If the array is empty or contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [2, 1, 3.5, 3, 4]; * arr.median(); // => 3 * ``` */ median(): Median; } } declare global { interface Array { /** * Returns the elements of an array that don't meet the condition. * @param predicate A function that accepts up to three arguments. The reject method calls the predicate function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. */ reject( predicate: (value: T, index: number, array: T[]) => boolean, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any, ): T[]; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns a new array that is sorted by the given functions. * @param array The array to process. * @param fns The functions to sort by. * * @example * ```typescript * const objs = [{ a: 1, b: 4 }, { a: 3, b: 2 }, { a: 3, b: 1 }]; * objs.sortBy((obj) => obj.b); // => [{ a: 3, b: 1 }, { a: 3, b: 2 }, { a: 1, b: 4 }] * objs.sortBy(prop('a'), prop('b')); // => [{ a: 1, b: 4 }, { a: 3, b: 1 }, { a: 3, b: 2 }] * ``` */ sortBy(...fns: Array<(value: T) => Ord>): T[]; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns a new array that is sorted by the given functions. * @param array The array to process. * @param fns The functions to sort by. * * @example * ```typescript * const objs = [{ a: 1, b: 4 }, { a: 3, b: 2 }, { a: 3, b: 1 }]; * objs.sortBy((obj) => obj.b); // => [{ a: 3, b: 1 }, { a: 3, b: 2 }, { a: 1, b: 4 }] * objs.sortBy(prop('a'), prop('b')); // => [{ a: 1, b: 4 }, { a: 3, b: 1 }, { a: 3, b: 2 }] * ``` */ sortBy(...fns: Array<(value: T) => Ord>): T[]; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns the sum of all elements in the array (only for number or bigint arrays). * * **Do not** use it with an array of bigint with zero elements, as it will return `0` instead of `0n`. * * @throws {TypeError} If the array contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.sum(); // => 6 * ``` */ sum(): Sum; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns the sum of all elements in the array (only for number or bigint arrays). * * **Do not** use it with an array of bigint with zero elements, as it will return `0` instead of `0n`. * * @throws {TypeError} If the array contains non-numbers or mixed numbers and bigints. * * @example * ```typescript * const arr = [1, 2, 3]; * arr.sum(); // => 6 * ``` */ sum(): Sum; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Takes the first `count` elements from the array. * @param count - The number of elements to take. * * @example * ```typescript * [1, 2, 3, 4, 5].take(3); // => [1, 2, 3] * [1, 2, 3, 4, 5].take(0); // => [] * [1, 2, 3, 4, 5].take(10); // => [1, 2, 3, 4, 5] * ``` */ take: ( this: AS, count: N, ) => IfpList< AS, Num.IfNat, Ary.Mutate$>, Yield1$ >; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Takes the first `count` elements from the array. * @param count - The number of elements to take. * * @example * ```typescript * [1, 2, 3, 4, 5].take(3); // => [1, 2, 3] * [1, 2, 3, 4, 5].take(0); // => [] * [1, 2, 3, 4, 5].take(10); // => [1, 2, 3, 4, 5] * ``` */ take: ( this: AS, count: N, ) => IfpList< AS, Num.IfNat, Ary.Mutate$>, Yield1$ >; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Takes elements from the array until the predicate returns `true`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].takeUntil((x) => x === 3); // => [1, 2] * [1, 2, 3, 4, 5].takeUntil((x) => x === 10); // => [1, 2, 3, 4, 5] * ``` */ takeUntil: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Takes elements from the array until the predicate returns `true`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].takeUntil((x) => x === 3); // => [1, 2] * [1, 2, 3, 4, 5].takeUntil((x) => x === 10); // => [1, 2, 3, 4, 5] * ``` */ takeUntil: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Takes elements from the array until the predicate returns `false`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].takeWhile((x) => x < 4); // => [1, 2, 3] * [1, 2, 3, 4, 5].takeWhile((x) => x > 10); // => [] * ``` */ takeWhile: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Takes elements from the array until the predicate returns `false`. * @param pred The predicate function. * * @example * ```typescript * [1, 2, 3, 4, 5].takeWhile((x) => x < 4); // => [1, 2, 3] * [1, 2, 3, 4, 5].takeWhile((x) => x > 10); // => [] * ``` */ takeWhile: ( this: AS, pred: (value: AS[number], index: number, array: AS) => boolean, ) => Ary.Mutate; } } declare global { interface Array { /** * Returns a duplicate-free version of the array, * in which only the first occurrence of each element is kept (using `equals` for equality comparisons). * * @example * ```typescript * const arr = [1, 2, 3, 1, 2, 3, { a: [2], c: { d: 10 } }, , { a: [2], c: { d: 10 } }]; * unique(arr); // => [1, 2, 3, { a: [2], c: { d: 10 } }] * ``` */ unique(): T[]; } interface ReadonlyArray { /** * Returns a duplicate-free version of the array, * in which only the first occurrence of each element is kept (using `equals` for equality comparisons). * * @example * ```typescript * const arr = [1, 2, 3, 1, 2, 3, { a: [2], c: { d: 10 } }, , { a: [2], c: { d: 10 } }]; * unique(arr); // => [1, 2, 3, { a: [2], c: { d: 10 } }] * ``` */ unique(): T[]; } } declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Array { /** * Returns a new array excluding all given values (using `equals` for equality comparisons). * @param values The values to exclude. * * @example * ```typescript * const arr = [1, 2, 3, 1, 2, 3, [1, 2, { b: 10 }]]; * arr.without(1, 2, [1, 2, { b: 10 }]); // => [3, 3] * ``` * * @see {@link equals} */ without< const AS extends readonly unknown[], const BS extends readonly AS[number][], >( this: AS, ...values: BS ): Without; } // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ReadonlyArray { /** * Returns a new array excluding all given values (using `equals` for equality comparisons). * @param values The values to exclude. * * @example * ```typescript * const arr = [1, 2, 3, 1, 2, 3, [1, 2, { b: 10 }]]; * arr.without(1, 2, [1, 2, { b: 10 }]); // => [3, 3] * ``` * * @see {@link equals} */ without< const AS extends readonly unknown[], const BS extends readonly AS[number][], >( this: AS, ...values: BS ): Without; } } declare global { interface BigInt { /** * Returns the string representation of the BigInt. * * It is an alias of `BigInt#toString`, and is used by `JSON.stringify` to convert the BigInt to a string. * * @example * ```typescript * const bigInt = 10n; * console.log(bigInt.toJSON()); // => "10" * ``` */ toJSON(): string; } } declare global { interface Date { /** * Return the formatted date string in the given format. (using `date-fns/format`) * * @example * ```typescript * new Date().format('yyyy-MM-dd HH:mm:ss'); // => '2023-09-01 12:34:56' * ``` * * @see {@link https://date-fns.org/v2.30.0/docs/format} */ format( ...args: [ format: Parameters[1], options?: Parameters[2], ] ): string; } } declare global { interface Number { /** * The corresponding `Duration` represented in years. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).years; // => 2n << (53n * 7n) * (2).years.asYears(); // => 2 * (2).years + (3).months; // => 2n << (53n * 7n) + 3n << (53n * 6n) * ((2).years + (3).months).asYears(); // => 2.25 * ((2).years + (3).months).asMonths(); // => 27 * ``` */ readonly years: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in months. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).months; // => 2n << (53n * 6n) * (2).months.asMonths(); // => 2 * (2).months + (3).weeks; // => 2n << (53n * 6n) + 3n << (53n * 5n) * ((2).months + (3).weeks).asMonths(); // => 2.689952565761104 * ((2).months + (3).weeks).asWeeks(); // => 11.69625 * ``` */ readonly months: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in fortnights (2 weeks). * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).fortnights; // => 4n << (53n * 5n) * (2).fortnights.asFortnights(); // => 2 * (2).fortnights + (3).days; // => 4n << (53n * 5n) + 3n << (53n * 4n) * ((2).fortnights + (3).days).asFortnights(); // => 2.2142857142857144 * ((2).fortnights + (3).days).asDays(); // => 31 * ``` */ readonly fortnights: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in weeks. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).weeks; // => 2n << (53n * 5n) * (2).weeks.asWeeks(); // => 2 * (2).weeks + (3).days; // => 2n << (53n * 5n) + 3n << (53n * 4n) * ((2).weeks + (3).days).asWeeks(); // => 2.4285714285714284 * ((2).weeks + (3).days).asDays(); // => 17 * ``` */ readonly weeks: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in days. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).days; // => 2n << (53n * 4n) * (2).days.asDays(); // => 2 * (2).days + (3).hours; // => 2n << (53n * 4n) + 3n << (53n * 3n) * ((2).days + (3).hours).asDays(); // => 2.125 * ((2).days + (3).hours).asHours(); // => 51 * ``` */ readonly days: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in hours. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).hours; // => 2n << (53n * 3n) * (2).hours.asHours(); // => 2 * (2).hours + (3).minutes; // => 2n << (53n * 3n) + 3n << (53n * 2n) * ((2).hours + (3).minutes).asHours(); // => 2.05 * ((2).hours + (3).minutes).asMinutes(); // => 123 * ``` */ readonly hours: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in minutes. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).minutes; // => 2n << (53n * 2n) * (2).minutes.asMinutes(); // => 2 * (2).minutes + (3).seconds; // => 2n << (53n * 2n) + 3n << (53n * 1n) * ((2).minutes + (3).seconds).asMinutes(); // => 2.05 * ((2).minutes + (3).seconds).asSeconds(); // => 123 * ``` */ readonly minutes: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in seconds. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).seconds; // => 2n << (53n * 1n) * (2).seconds.asSeconds(); // => 2 * (2).seconds + (3).milliseconds; // => 2n << (53n * 1n) + 3n << (53n * 0n) * ((2).seconds + (3).milliseconds).asSeconds(); // => 2.003 * ((2).seconds + (3).milliseconds).asMilliseconds(); // => 2003 * ``` */ readonly seconds: bigint; } } declare global { interface Number { /** * The corresponding `Duration` represented in milliseconds. * * `Duration`s are represented as a `bigint` with 53 bits per unit internally. * * @example * ```typescript * (2).milliseconds; // => 2n << (53n * 0n) * (2).milliseconds.asMilliseconds(); // => 2 * (2).seconds + (3).milliseconds; // => 2n << (53n * 1n) + 3n << (53n * 0n) * ((2).seconds + (3).milliseconds).asSeconds(); // => 2.003 * ((2).seconds + (3).milliseconds).asMilliseconds(); // => 2003 * ``` */ readonly milliseconds: bigint; } } declare global { interface BigInt { /** * Returns the total number of years of the `Duration`. * * @example * ```typescript * (2).years.asYears(); // => 2 * ((2).years + (3).months).asYears(); // => 2.25 * ``` */ asYears(): number; } } declare global { interface BigInt { /** * Returns the total number of months of the `Duration`. * * @example * ```typescript * (2).months.asMonths(); // => 2 * ((2).months + (3).weeks).asMonths(); // => 2.689952565761104 * ``` */ asMonths(): number; } } declare global { interface BigInt { /** * Returns the total number of fortnights (2 weeks) of the `Duration`. * * @example * ```typescript * (2).fortnights.asFortnights(); // => 2 * ((2).fortnights + (3).days).asFortnights(); // => 2.2142857142857144 * ``` */ asFortnights(): number; } } declare global { interface BigInt { /** * Returns the total number of weeks of the `Duration`. * * @example * ```typescript * (2).weeks.asWeeks(); // => 2 * ((2).weeks + (3).days).asWeeks(); // => 2.4285714285714284 * ``` */ asWeeks(): number; } } declare global { interface BigInt { /** * Returns the total number of days of the `Duration`. * * @example * ```typescript * (2).days.asDays(); // => 2 * ((2).days + (3).hours).asDays(); // => 2.125 * ``` */ asDays(): number; } } declare global { interface BigInt { /** * Returns the total number of hours of the `Duration`. * * @example * ```typescript * (2).hours.asHours(); // => 2 * ((2).hours + (3).minutes).asHours(); // => 2.05 * ``` */ asHours(): number; } } declare global { interface BigInt { /** * Returns the total number of minutes of the `Duration`. * * @example * ```typescript * (2).minutes.asMinutes(); // => 2 * ((2).minutes + (3).seconds).asMinutes(); // => 2.05 * ``` */ asMinutes(): number; } } declare global { interface BigInt { /** * Returns the total number of seconds of the `Duration`. * * @example * ```typescript * (2).seconds.asSeconds(); // => 2 * ((2).seconds + (3).milliseconds).asSeconds(); // => 2.003 * ``` */ asSeconds(): number; } } declare global { interface BigInt { /** * Returns the total number of milliseconds of the `Duration`. * * @example * ```typescript * (2).milliseconds.asMilliseconds(); // => 2 * ((2).seconds + (3).milliseconds).asMilliseconds(); // => 2003 * ``` */ asMilliseconds(): number; } } declare global { interface BigInt { /** * Parts of the `Duration` represented as an object. * * @example * ```typescript * (2).years.parts; // => { years: 2, months: 0, weeks: 0, days: 0, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 } * ((2).years + (3).months).parts; // => { years: 2, months: 3, weeks: 0, days: 0, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 } * ``` */ readonly parts: { years: number; months: number; weeks: number; days: number; hours: number; minutes: number; seconds: number; milliseconds: number; }; } } declare global { interface BigInt { /** * Returns the `Date` before the given `date` by the `Duration`. * @param date The `Date` to get the `Date` before by the `Duration`. * * @example * ```typescript * const date = new Date(); * console.log(date); // 2023-09-01T00:00:00.000Z * (2).years.before(date); // => 2021-09-01T00:00:00.000Z * ((2).years + (3).months).before(date); // => 2021-06-01T00:00:00.000Z * ``` */ before(date: number | Date): Date; } } declare global { interface BigInt { /** * Returns the `Date` before the current `Date` by the `Duration`. * * @example * ```typescript * new Date(); // => 2023-09-01T00:00:00.000Z * (2).years.ago(); // => 2021-09-01T00:00:00.000Z * ((2).years + (3).months).ago(); // => 2021-06-01T00:00:00.000Z * ``` */ ago(): Date; } } declare global { interface BigInt { /** * Returns the `Date` after the given `date` by the `Duration`. * @param date The `Date` to get the `Date` after by the `Duration`. * * @example * ```typescript * const date = new Date(); * console.log(date); // 2023-09-01T00:00:00.000Z * (2).years.after(date); // => 2025-09-01T00:00:00.000Z * ((2).years + (3).months).after(date); // => 2025-12-01T00:00:00.000Z * ``` */ after(date: number | Date): Date; } } declare global { interface BigInt { /** * Returns the `Date` after the current `Date` by the `Duration`. * * @example * ```typescript * new Date(); // => 2023-09-01T00:00:00.000Z * (2).years.fromNow(); // => 2025-09-01T00:00:00.000Z * ((2).years + (3).months).fromNow(); // => 2025-12-01T00:00:00.000Z * ``` */ fromNow(): Date; } } declare global { /** * Creates an object with additional methods. * @param o The object to extend. * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3 }; * ex(obj).filter(([k, v]) => v % 2 === 0).mapKeys((k) => k.toUpperCase()); // => { B: 2 } * ex(obj).omit('a', 'b').size(); // => 1 * ``` */ function ex(o: O): ExtendedObject; } declare global { /** * Returns a shallow clone of value. * * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays, * array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols, * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty * object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps. * * @param value The value to clone. * * @example * ```typescript * const obj = { a: 1 }; * const copy = clone(obj); * console.log(copy); // { a: 1 } * copy.a = 2; * console.log(obj); // { a: 1 } * console.log(copy); // { a: 2 } * * const objs = [{ a: 1 }, { b: 2 }]; * const shallow = clone(objs); * shallow[0] === objs[0]; // => true * ``` */ function clone(value: T): T; } declare global { /** * Returns a deep clone of value. * * This method is like `clone` except that it recursively clones value. * * @param value The value to recursively clone. * * @example * ```typescript * const objs = [{ a: 1 }, { b: 2 }]; * const deep = cloneDeep(objs); * deep[0] === objs[0]; // => false * ``` * * @see {@link clone} */ function cloneDeep(value: T): T; } declare global { /** * Returns a curried version of the provided function. * @param fn The function to curry. * * @example * ```typescript * const add = (a: number, b: number) => a + b; * const curriedAdd = curried(add); * const add2 = curriedAdd(2); * add2(3); // => 5 * ``` */ function curried(fn: (a: A) => R): (a: A) => R; function curried(fn: (a: A, b: B) => R): (a: A) => (b: B) => R; function curried( fn: (a: A, b: B, c: C) => R, ): (a: A) => (b: B) => (c: C) => R; function curried( fn: (a: A, b: B, c: C, d: D) => R, ): (a: A) => (b: B) => (c: C) => (d: D) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E) => R, ): (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F) => R, ): (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => (f: F) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => R, ): (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => (f: F) => (g: G) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => R, ): ( a: A, ) => (b: B) => (c: C) => (d: D) => (e: E) => (f: F) => (g: G) => (h: H) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => R, ): ( a: A, ) => ( b: B, ) => (c: C) => (d: D) => (e: E) => (f: F) => (g: G) => (h: H) => (i: I) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => (d: D) => (e: E) => (f: F) => (g: G) => (h: H) => (i: I) => (j: J) => R; function curried( fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => (e: E) => (f: F) => (g: G) => (h: H) => (i: I) => (j: J) => (k: K) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => (f: F) => (g: G) => (h: H) => (i: I) => (j: J) => (k: K) => (l: L) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => ( f: F, ) => (g: G) => (h: H) => (i: I) => (j: J) => (k: K) => (l: L) => (m: M) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => ( f: F, ) => ( g: G, ) => (h: H) => (i: I) => (j: J) => (k: K) => (l: L) => (m: M) => (n: N) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => ( f: F, ) => ( g: G, ) => ( h: H, ) => (i: I) => (j: J) => (k: K) => (l: L) => (m: M) => (n: N) => (o: O) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => ( f: F, ) => ( g: G, ) => ( h: H, ) => ( i: I, ) => (j: J) => (k: K) => (l: L) => (m: M) => (n: N) => (o: O) => (p: P) => R; function curried( fn: ( a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L, m: M, n: N, o: O, p: P, q: Q, ) => R, ): ( a: A, ) => ( b: B, ) => ( c: C, ) => ( d: D, ) => ( e: E, ) => ( f: F, ) => ( g: G, ) => ( h: H, ) => ( i: I, ) => ( j: J, ) => (k: K) => (l: L) => (m: M) => (n: N) => (o: O) => (p: P) => (q: Q) => R; function curried( fn: (...args: unknown[]) => unknown, ): (...args: unknown[]) => unknown; } declare global { /** * Enumerate an iterable, yielding tuples of the form `[index, item]`. * @param iterable The iterable to enumerate. * * @example * ```typescript * for (const [i, item] of enumerate(['a', 'b', 'c'])) { * console.log(i, item); * // 0 'a' * // 1 'b' * // 2 'c' * } * ``` */ function enumerate(iterable: Iterable): Iterable<[number, T]>; } declare global { /** * Returns `true` if its arguments are equivalent (recursively). Handles cyclical data structures. * * Dispatches symmetrically to the `equals` methods of both arguments, if present. * @param a The first item to compare. * @param b The second item to compare. * * @example * ```typescript * equals(1, 1); //=> true * equals(1, '1'); //=> false * equals([1, 2, 3], [1, 2, 3]); //=> true * equals({ a: [1], b: { c: 'd' } }, { a: [1], b: { c: 'd' } }); //=> true * * const a = {}; * a.v = a; * const b = {}; * b.v = b; * equals(a, b); // => true * ``` */ function equals(a: unknown, b: T): a is T; function equals(b: T): (a: unknown) => a is T; } declare global { /** * Returns a function that when given a value invokes the specified method. `iv` is short for "invoke". * @param name The method to get. * * @example * ```typescript * const obj = { a: 1, b: 2, c: () => 3 }; * const objs = [{ a: 1, b: 2, c: () => 3 }, { a: 4, b: 5, c: () => 6 }]; * objs.map(iv('c')); // => [3, 6] * [' a', ' b', ' c'].map(iv('trim')); // => ['a', 'b', 'c'] * iv('c')(obj); // => 3 * ``` */ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - TODO: Fix this function iv>( name: P, // @ts-expect-error - TS doesn't know T[P] is a function ): (x: T) => ReturnType; } declare global { /** * Returns a tuple of the given elements. * * It is the same as `[...elements] as const`, but with a more readable syntax. * @param elements The elements to return. * * @example * ```typescript * list(1, 2, 3); // => [1, 2, 3] * const as = list('a', 'b', 'c'); // as :: readonly ['a', 'b', 'c'] * ``` */ function list(...elements: AS): AS; } declare global { /** * Returns a function that when given an object returns the value of the specified path. * * The function also has a number of extensions that can be used to compare the value of the path. * @param path The path to get, can be either a string or an array of strings. * * @example * ```typescript * const obj = { a: { b: [1, 2, 3] } }; * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.map(path('a.b[0]')); // => [1, 4] * objs.map(path(['a', 'b', '0'])); // => [1, 4] * path('a.b[0]')(obj); // => 1 * path(['a', 'b', '0'])(obj); // => 1 * ``` * * @example * ```typescript * const objs = [{ a: { b: [1, 2, 3] } }, { a: { b: [4, 5, 6] } }]; * objs.filter(path('a.b[0]').eq(1)); // => [{ a: { b: [1, 2, 3] } }] * objs.filter(path(['a', 'b', '0']).eq(1)); // => [{ a: { b: [1, 2, 3] } }] * ``` */ function path< const O extends object, const P extends object extends O ? string | readonly string[] : BasePath | BasePathArray, >(path: P): PathFn; } declare global { /** * Returns a function that when given an object returns the value of the specified property. * * The function also has a number of extensions that can be used to compare the value of the property. * @param prop The property to get. * * @example * ```typescript * const obj = { a: 1, b: 2 }; * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.map(prop('a')); // => [1, 3] * prop('a')(obj); // => 1 * ``` * * @example * ```typescript * const objs = [{ a: 1, b: 2 }, { a: 3, b: 4 }]; * objs.filter(prop('a').eq(1)); // => [{ a: 1, b: 2 }] * ``` */ function prop( prop: P, ): PropFn; } declare global { /** * Split a string separated by spaces into an array of words. * @param str The string to split. * * @example * ```typescript * words(' foo bar baz '); // => ['foo', 'bar', 'baz'] * ``` * * @example * ```typescript * const colors = words('red green blue'); // colors :: ['red', 'green', 'blue'] * const redAndBlue = colors.without('green'); // redAndBlue :: ['red', 'blue'] * * const trafficLights: string = 'red yellow green'; * const trafficLightsState = words(trafficLights); // trafficLightsState :: string[] * ``` */ function words(str: S): Words; } declare global { /** * Returns `true` if the values are the same value (using `Object.is`). * @param a The first value. * @param b The second value. * * @example * ```typescript * // Case 1: Evaluation result is the same as using `===` * is(25, 25); // => true * is('foo', 'foo'); // => true * is('foo', 'bar'); // => false * is(null, null); // => true * is(undefined, undefined); // => true * is(globalThis, globalThis); // => true * is([], []); // => false * const foo = { a: 1 }; * const bar = { a: 1 }; * const sameFoo = foo; * is(foo, foo); // => true * is(foo, bar); // => false * is(foo, sameFoo); // => true * ``` * * @example * ```typescript * // Case 2: Signed zero * is(0, -0); // => false * is(+0, -0); // => false * is(-0, -0); // => true * ``` * * @example * ```typescript * // Case 3: NaN * is(NaN, 0 / 0); // => true * is(NaN, Number.NaN); // => true * ``` * * @see {@link Object.is} */ function is(a: unknown, b: T): a is T; function is(b: T): (a: unknown) => a is T; } declare global { /** * Returns `true` if the value is an array (using `Array.isArray`). * @param value The value to check. * * @example * ```typescript * isArray([]); // => true * isArray([1, 2, 3]); // => true * isArray({}); // => false * isArray(''); // => false * isArray(new Array(5)); // => true * isArray(new Int16Array([15, 33])); // => false * ``` * * @example * ```typescript * const arr: number[] | null = [1, 2, 3]; * if (isArray(arr)) { * const arr2 = arr; // arr2 :: number[] * } * ``` * * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray} */ function isArray(value: unknown): value is unknown[]; } declare global { /** * Returns `true` if the value is array-like (i.e. has a integer `length` property between `0` and `Number.MAX_SAFE_INTEGER`). * @param value The value to check. * * @example * ```typescript * isArrayLike([]); // => true * isArrayLike({ length: 2 }); // => true * isArrayLike({ length: 2.5 }); // => false * isArrayLike({ length: -1 }); // => false * isArrayLike({ length: Number.MAX_SAFE_INTEGER }); // => true * isArrayLike({ length: Number.MAX_SAFE_INTEGER + 1 }); // => false * isArrayLike({ length: Infinity }); // => false * isArrayLike('abc'); // => true * isArrayLike({}); // => false * ``` */ function isArrayLike(value: unknown): value is ArrayLike; } declare global { /** * Returns `true` if the value is classified as a bigint primitive or object. * @param value The value to check. * * @example * ```typescript * isBigInt(0n); // => true * isBigInt(1n); // => true * isBigInt(Object(BigInt(1))); // => true * isBigInt(''); // => false * ``` */ // eslint-disable-next-line @typescript-eslint/ban-types function isBigInt(value: unknown): value is bigint | BigInt; } declare global { /** * Returns `true` if the value is a bigint primitive. * @param value The value to check. * * @example * ```typescript * isBigIntPrimitive(0n); // => true * isBigIntPrimitive(1n); // => true * isBigIntPrimitive(''); // => false * ``` */ function isBigIntPrimitive(value: unknown): value is bigint; } declare global { /** * Returns `true` if the value is classified as a boolean primitive or object. * @param value The value to check. * * @example * ```typescript * isBoolean(true); // => true * isBoolean(false); // => true * isBoolean(new Boolean(true)); // => true * isBoolean(''); // => false * ``` */ // eslint-disable-next-line @typescript-eslint/ban-types function isBoolean(value: unknown): value is boolean | Boolean; } declare global { /** * Returns `true` if the value is a boolean primitive. * @param value The value to check. * * @example * ```typescript * isBooleanPrimitive(true); // => true * isBooleanPrimitive(false); // => true * isBooleanPrimitive(0); // => false * ``` */ function isBooleanPrimitive(value: unknown): value is boolean; } declare global { /** * Returns `true` if the value is a buffer (using `Buffer.isBuffer` if `Buffer` exists, * otherwise always returns `false`). * @param value The value to check. * * @example * ```typescript * isBuffer(new Buffer(2)); // => true * isBuffer(new Uint8Array(2)); // => false * ``` */ function isBuffer(value: unknown): value is Buffer; } declare global { /** * Falsy values in TypeScript. * * **Note:** NaN is a falsy value, but it is not included in this type, as it cannot be represented as a type literal. */ type Falsy = false | 0 | 0n | '' | null | undefined; /** * Returns `true` if the value is falsy. (i.e. `false`, `0`, `-0`, `0n`, `NaN`, `''`, `null`, or `undefined`) * @param value The value to check. * * @example * ```typescript * isFalsy(false); // => true * isFalsy(0); // => true * isFalsy(0n); // => true * isFalsy(NaN); // => true * isFalsy(''); // => true * isFalsy(null); // => true * isFalsy(undefined); // => true * isFalsy(' '); // => false * isFalsy([]); // => false * isFalsy({}); // => false * isFalsy(() => {}); // => false * isFalsy('a'); // => false * ``` */ function isFalsy(value: unknown): value is Falsy; } declare global { /** * Returns `true` if the value is a function. * @param value The value to check. * * @example * ```typescript * isFunction(() => {}); // => true * isFunction(function() {}); // => true * isFunction(async () => {}); // => true * isFunction(function*() {}); // => true * isFunction(async function*() {}); // => true * isFunction(new Function()); // => true * isFunction(function*() {}.bind(null)); // => true * isFunction(async function*() {}.bind(null)); // => true * isFunction(new Proxy(() => {}, {})); // => true * isFunction(new Proxy({}, {})); // => true * isFunction(''); // => false * ``` */ function isFunction(value: unknown): value is (...args: unknown[]) => unknown; } declare global { /** * Returns `true` if the value is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * @param value The value to check. * * @example * ```typescript * isLength(3); // => true * isLength(-1); // => false * isLength(1.23); // => false * isLength(Number.MAX_SAFE_INTEGER); // => true * isLength(Number.MAX_SAFE_INTEGER + 1); // => false * isLength(Infinity); // => false * ``` */ function isLength(value: unknown): value is number; } declare global { /** * Returns `true` if the value is a `Map`. * @param value The value to check. * * @example * ```typescript * isMap(new Map()); // => true * isMap(new WeakMap()); // => false * ``` */ function isMap(value: unknown): value is Map; } declare global { /** * Exclude `null` from `T`. */ type NonNull = Exclude; /** * Returns `true` if the value is not null. * @param value The value to check. * * @example * ```typescript * isNonNull(null); // => false * isNonNull(undefined); // => true * isNonNull(''); // => true * isNonNull(' '); // => true * isNonNull('a'); // => true * isNonNull(0); // => true * ``` * * @example * ```typescript * const foo: string | null | undefined = null; * if (isNonNull(foo)) { * const bar = foo; // bar :: string | undefined * } * ``` * * @see {@link isNull} */ function isNonNull(value: T): value is NonNull; } declare global { /** * Exclude `null` and `undefined` from `T`. */ type NonNullish = Exclude; /** * Returns `true` if the value is not null or undefined. * @param value The value to check. * * @example * ```typescript * isNonNullish(null); // => false * isNonNullish(undefined); // => false * isNonNullish(''); // => true * isNonNullish(' '); // => true * isNonNullish('a'); // => true * isNonNullish(0); // => true * ``` * * @example * ```typescript * const foo: string | null = null; * if (isNonNullish(foo)) { * const bar = foo; // bar :: string * } * ``` * * @see {@link isNullish} */ function isNonNullish(value: T): value is NonNullish; } declare global { /** * Exclude `undefined` from `T`. */ type NonUndefined = Exclude; /** * Returns `true` if the value is not undefined. * @param value The value to check. * * @example * ```typescript * isNonUndefined(null); // => true * isNonUndefined(undefined); // => false * isNonUndefined(''); // => true * isNonUndefined(' '); // => true * isNonUndefined('a'); // => true * isNonUndefined(0); // => true * ``` * * @example * ```typescript * const foo: string | null | undefined = null; * if (isNonUndefined(foo)) { * const bar = foo; // bar :: string | null * } * ``` * * @see {@link isUndefined} */ function isNonUndefined(value: T): value is NonUndefined; } declare global { /** * Returns `true` if the value is null. * @param value The value to check. * * @example * ```typescript * isNull(null); // => true * isNull(undefined); // => false * isNull(''); // => false * isNull(' '); // => false * isNull('a'); // => false * isNull(0); // => false * ``` * * @example * ```typescript * const foo: string | null = null; * if (isNull(foo)) { * const bar = foo; // bar :: null * } * ``` */ function isNull(value: unknown): value is null; } declare global { /** * A type that is either null or undefined. */ type Nullish = null | undefined; /** * Returns `true` if the value is null or undefined. * @param value The value to check. * * @example * ```typescript * isNullish(null); // => true * isNullish(undefined); // => true * isNullish(''); // => false * isNullish(' '); // => false * isNullish('a'); // => false * isNullish(0); // => false * ``` * * @example * ```typescript * const foo: string | null = null; * if (isNullish(foo)) { * const bar = foo; // bar :: null * } * ``` */ function isNullish(value: unknown): value is Nullish; } declare global { /** * Returns `true` if the value is classified as a number primitive or object. * @param value The value to check. * * @example * ```typescript * isNumber(0); // => true * isNumber(1); // => true * isNumber(1.5); // => true * isNumber(new Number(1)); // => true * isNumber(''); // => false * ``` */ // eslint-disable-next-line @typescript-eslint/ban-types function isNumber(value: unknown): value is number | Number; } declare global { /** * Returns `true` if the value is a number primitive. * @param value The value to check. * * @example * ```typescript * isNumberPrimitive(0); // => true * isNumberPrimitive(1); // => true * isNumberPrimitive(1.5); // => true * isNumberPrimitive(''); // => false * ``` */ function isNumberPrimitive(value: unknown): value is number; } declare global { /** * Returns `true` if the value is classified as a numeric primitive or object (number primitive, bigint primitive, Number object, or BigInt object) * @param value The value to check. * * @example * ```typescript * isNumeric(0); // => true * isNumeric(1); // => true * isNumeric(1.5); // => true * isNumeric(0n); // => true * isNumeric(1n); // => true * isNumeric(new Number(1)); // => true * isNumeric(Object(BigInt(1))); // => true * isNumeric(''); // => false * ``` */ function isNumeric(value: unknown): value is | number | bigint // eslint-disable-next-line @typescript-eslint/ban-types | Number // eslint-disable-next-line @typescript-eslint/ban-types | BigInt; } declare global { /** * Returns `true` if the value is a numeric primitive (number primitive or bigint primitive). * @param value The value to check. * * @example * ```typescript * isNumericPrimitive(0); // => true * isNumericPrimitive(1); // => true * isNumericPrimitive(1.5); // => true * isNumericPrimitive(0n); // => true * isNumericPrimitive(1n); // => true * isNumericPrimitive(''); // => false * ``` */ function isNumericPrimitive(value: unknown): value is number | bigint; } declare global { /** * Returns `true` if the value is an object. (i.e. not a primitive) * @param value The value to check. * * @example * ```typescript * isObject({}); // => true * isObject([]); // => true * isObject(() => {}); // => true * isObject(/a/); // => true * isObject(new Number(0)); // => true * isObject(new String('')); // => true * isObject(''); // => false * isObject('a'); // => false * isObject(0); // => false * isObject(false); // => false * isObject(null); // => false * isObject(undefined); // => false * ``` * * @see {@link isPrimitive} */ function isObject(value: unknown): value is object; } declare global { /** * Returns `true` if the value is object-like, meaning it's not `null` and has a `typeof` result of `"object"`. * @param value The value to check. * * @example * ```typescript * isObjectLike({}); // => true * isObjectLike([1, 2, 3]); // => true * isObjectLike(new Set([1, 2, 3])); // => true * isObjectLike(new Map([['a', 1], ['b', 2], ['c', 3]])); // => true * isObjectLike(null); // => false * isObjectLike(undefined); // => false * isObjectLike(0); // => false * ``` */ function isObjectLike(value: unknown): value is Record; } declare global { /** * Checks if the value is a plain object, that is, an object created by the `Object` constructor or one with a * `[[Prototype]]` of `null`. * * **Note**: This method assumes objects created by the Object constructor have no inherited enumerable properties. * @param value The value to check. * * @example * ```typescript * class Foo { * a = 1; * } * isPlainObject(new Foo()); // => false * isPlainObject([1, 2, 3]); // => false * isPlainObject({ x: 1, y: 2 }); // => true * isPlainObject(Object.create(null)); // => true * ``` */ function isPlainObject( value: unknown, ): value is Record; } declare global { /** * Primitive types in TypeScript. */ type Primitive = | string | number | boolean | bigint | symbol | undefined | null; /** * Returns `true` if the value is a primitive. * @value The value to check. * * @example * ```typescript * isPrimitive(''); // => true * isPrimitive('a'); // => true * isPrimitive(0); // => true * isPrimitive(false); // => true * isPrimitive(null); // => true * isPrimitive(undefined); // => true * isPrimitive({}); // => false * isPrimitive([]); // => false * isPrimitive(() => {}); // => false * isObject(/a/); // => false * isObject(new Number(0)); // => false * isObject(new String('')); // => false * ``` * * @see {@link isObject} */ function isPrimitive(value: unknown): value is Primitive; } declare global { /** * Returns `true` if the value is a `Set`. * @param value The value to check. * * @example * ```typescript * isSet(new Set()); // => true * isSet(new WeakSet()); // => false * ``` */ function isSet(value: unknown): value is Set; } declare global { /** * Returns `true` if the value is a classified as a string primitive or object. * @param value The value to check. * * @example * ```typescript * isString(''); // => true * isString('a'); // => true * isString(new String('')); // => true * isString(0); // => false * ``` */ // eslint-disable-next-line @typescript-eslint/ban-types function isString(value: unknown): value is string | String; } declare global { /** * Returns `true` if the value is a string primitive. * @param value The value to check. * * @example * ```typescript * isStringPrimitive(''); // => true * isStringPrimitive('a'); // => true * isStringPrimitive(0); // => false * ``` */ function isStringPrimitive(value: unknown): value is string; } declare global { /** * Returns `true` if the value is classified as a symbol primitive or object. * @param value The value to check. * * @example * ```typescript * isSymbol(Symbol('foo')); // => true * isSymbol(Symbol.iterator); // => true * isSymbol(Object(Symbol('foo'))); // => true * isSymbol('foo'); // => false * ``` */ // eslint-disable-next-line @typescript-eslint/ban-types function isSymbol(value: unknown): value is symbol | Symbol; } declare global { /** * Returns `true` if the value is a symbol primitive. * @param value The value to check. * * @example * ```typescript * isSymbolPrimitive(Symbol('foo')); // => true * isSymbolPrimitive(Symbol.iterator); // => true * isSymbolPrimitive('foo'); // => false * ``` */ function isSymbolPrimitive(value: unknown): value is symbol; } declare global { /** * Returns `true` if the value is truthy. (i.e. not `false`, `0`, `-0`, `0n`, `NaN`, `''`, `null`, or `undefined`) * @param value The value to check. * * @example * ```typescript * isTruthy(true); // => true * isTruthy(1); // => true * isTruthy('a'); // => true * isTruthy([]); // => true * isTruthy({}); // => true * isTruthy(() => {}); // => true * isTruthy(' '); // => true * isTruthy(''); // => false * isTruthy(0); // => false * isTruthy(0n); // => false * isTruthy(NaN); // => false * isTruthy(false); // => false * isTruthy(null); // => false * isTruthy(undefined); // => false * ``` * * @see {@link isFalsy} */ function isTruthy(value: T): value is Exclude; } declare global { /** * Returns `true` if the value is undefined. * @param value The value to check. * * @example * ```typescript * isUndefined(null); // => false * isUndefined(undefined); // => true * isUndefined(''); // => false * isUndefined(' '); // => false * isUndefined('a'); // => false * isUndefined(0); // => false * ``` * * @example * ```typescript * const foo: string | undefined = null; * if (isUndefined(foo)) { * const bar = foo; // bar :: undefined * } * ``` */ function isUndefined(value: unknown): value is undefined; } declare global { interface Math { /** * Returns the greatest common divisor (gcd) of a list of numbers. * The result is always positive even if one or more of the arguments are negative. * `Math.gcd(0, x)` and `Math.gcd(x, 0)` returns `Math.abs(x)`. * @param values - A list of numbers. * * @example * ```typescript * Math.gcd(8, 36); // => 4 * Math.gcd(-4, 6, 8); // => 2 * Math.gcd(12, 8, 32); // => 4 * Math.gcd(0, 12); // => 12 * Math.gcd(12, 0, 8); // => 4 * ``` */ gcd(...values: number[]): number; } } declare global { interface Math { /** * Returns the greatest common divisor (gcd) and the least common multiple (lcm) of a list of numbers as a tuple of two numbers (representing gcd and lcm respectively). * The result is always positive even if one or more of the arguments are negative. * `Math.gcdlcm(0, x)` and `Math.gcdlcm(x, 0)` returns `[Math.abs(x), 0]`. * @param values - A list of numbers. * * @example * ```typescript * Math.gcdlcm(8, 36); // => [4, 72] * Math.gcdlcm(-4, 6, 8); // => [2, 24] * Math.gcdlcm(12, 8, 32); // => [4, 96] * Math.gcdlcm(0, 12); // => [12, 0] * Math.gcdlcm(12, 0, 8); // => [4, 0] * ``` * * @see {@link Math.gcd} * @see {@link Math.lcm} */ gcdlcm(...values: number[]): [number, number]; } } declare global { interface Math { /** * Returns the least common multiple (lcm) of a list of numbers. * The result is always positive even if one or more of the arguments are negative. * `Math.lcm(0, x)` and `Math.lcm(x, 0)` returns `0`. * @param values - A list of numbers. * * @example * ```typescript * Math.lcm(8, 36); // => 72 * Math.lcm(-4, 6, 8); // => 24 * Math.lcm(12, 8, 32); // => 96 * Math.lcm(0, 12); // => 0 * Math.lcm(12, 0, 8); // => 0 * ``` */ lcm(...values: number[]): number; } } declare global { interface Number { /** * The corresponding size represented in bytes. * It simply returns the number itself. * This exists only for consistency with other size units. * * @example * ```typescript * (5).bytes; // => 5 * ``` */ readonly bytes: number; } } declare global { interface Number { /** * The corresponding size represented in kilobytes. * * @example * ```typescript * (2).kilobytes; // => 2048 * ``` */ readonly kilobytes: number; } } declare global { interface Number { /** * The corresponding size represented in megabytes. * * @example * ```typescript * (2).megabytes; // => 2097152 * ``` */ readonly megabytes: number; } } declare global { interface Number { /** * The corresponding size represented in gigabytes. * * @example * ```typescript * (2).gigabytes; // => 2147483648 * ``` */ readonly gigabytes: number; } } declare global { interface Number { /** * The corresponding size represented in terabytes. * * @example * ```typescript * (2).terabytes; // => 2199023255552 * ``` */ readonly terabytes: number; } } declare global { interface Number { /** * The corresponding size represented in petabytes. * * @example * ```typescript * (2).petabytes; // => 2251799813685248 * ``` */ readonly petabytes: number; } } declare global { interface Number { /** * Returns the absolute value of the number (using `Math.abs`). * * @example * ```typescript * (-5).abs(); // => 5 * (5).abs(); // => 5 * NaN.abs(); // => NaN * ``` * * @see {@link Math.abs} */ abs(): number; } } declare global { interface Number { /** * An array of bits representing the number, from least significant to most significant. * * @example * ```typescript * 0b1010.bits; // => [0, 1, 0, 1] * 0b1010.bits[0]; // => 0 * ``` */ readonly bits: number[]; } } declare global { interface Number { /** * Returns the smallest integer greater than or equal to the number (using `Math.ceil`). * * @example * ```typescript * 1.95.ceil(); // => 2 * 2.4.ceil(); // => 3 * (3).ceil(); // => 3 * ``` * * @see {@link Math.ceil} */ ceil(): number; } } declare global { interface Number { /** * Return `min` if the number is less than `min`, `max` if the number is greater than `max`, or the number itself if it is neither. * @param min The minimum value. * @param max The maximum value. * * @example * ```typescript * 5.clamp(0, 10); // => 5 * 15.clamp(0, 10); // => 10 * (-5).clamp(0, 10); // => 0 * ``` */ clamp(min: number, max: number): number; } } declare global { interface Number { /** * Returns the number of digits in the number. * @param radix The base to use for the calculation. Defaults to 10. * * @example * ```typescript * (12345).digits; // => CallableArray(5, 4, 3, 2, 1) * (12345).digits[1]; // => 4 * (12345).digits(); // => [5, 4, 3, 2, 1] * (12345).digits(10); // => [5, 4, 3, 2, 1] * (12345).digits(7); // => [4, 6, 6, 0, 5] * (12345).digits(100); // => [45, 23, 1] * ``` */ readonly digits: CallableArray number[]>; } } declare global { interface Number { /** * Returns the quotient and remainder of the number divided by the divisor. * * @example * ```typescript * (11).divmod(4); // => [2, 3] * (-11).divmod(4); // => [-2, -3] * ``` * * @see {@link Math.trunc} */ divmod(divisor: number): [number, number]; } } declare global { interface Number { /** * Returns the greatest integer less than or equal to the number (using `Math.floor`). * * @example * ```typescript * 1.95.floor(); // => 1 * 2.4.floor(); // => 2 * (3).floor(); // => 3 * ``` * * @see {@link Math.floor} */ floor(): number; } } declare global { interface Number { /** * Returns `true` if the number is between the given numbers, inclusive. * * @example * ```typescript * (3).isBetween(1, 5); // => true * (1).isBetween(1, 5); // => true * (5).isBetween(1, 5); // => true * (0).isBetween(1, 5); // => false * ``` */ isBetween(min: number, max: number): boolean; } } declare global { interface Number { /** * Returns `true` if the number is even. * * @example * ```typescript * (3).isEven(); // => true * (4).isEven(); // => false * 3.0.isEven(); // => true * 1.95.isEven(); // => false * ``` */ isEven(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is finite — that is, the number is neither `Infinity`, `-Infinity`, nor `NaN` (using `Number.isFinite`). * * @example * ```typescript * 1.95.isFinite(); // => true * NaN.isFinite(); // => false * Infinity.isFinite(); // => false * -Infinity.isFinite(); // => false * ``` * * @see {@link Number.isFinite} */ isFinite(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is infinite — that is, the number is `Infinity` or `-Infinity`. * * @example * ```typescript * 1.95.isInfinite(); // => false * NaN.isInfinite(); // => false * Infinity.isInfinite(); // => true * -Infinity.isInfinite(); // => true * ``` */ isInfinite(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is integer (using `Number.isInteger`). * * @example * ```typescript * 1.95.isInteger(); // => false * NaN.isInteger(); // => false * Infinity.isInteger(); // => false * -Infinity.isInteger(); // => false * (3).isInteger(); // => true * 3.0.isInteger(); // => true * (0).isInteger(); // => true * (-0).isInteger(); // => true * ``` * * @see {@link Number.isInteger} */ isInteger(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is a valid array-like length (using `isLength`). * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * @param value The value to check. * * @example * ```typescript * (3).isLength(); // => true * (-1).isLength(); // => false * 1.23.isLength(); // => false * Number.MAX_SAFE_INTEGER.isLength(); // => true * (Number.MAX_SAFE_INTEGER + 1).isLength(); // => false * Infinity.isLength(); // => false * ``` * * @see {@link global.isLength} */ isLength(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is NaN (using `Number.isNaN`). * * @example * ```typescript * 1.95.isNaN(); // => false * NaN.isNaN(); // => true * Infinity.isNaN(); // => false * -Infinity.isNaN(); // => false * ``` * * @see {@link Number.isNaN} */ isNaN(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is negative (using `Math.sign`). * * @example * ```typescript * 1.95.isNegative(); // => false * -1.95.isNegative(); // => true * NaN.isNegative(); // => false * Infinity.isNegative(); // => false * -Infinity.isNegative(); // => true * ``` * * @see {@link Math.sign} */ isNegative(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is not zero. * * @example * ```typescript * 1.95.isNotZero(); // => true * (0).isNotZero(); // => false * (-0).isNotZero(); // => false * NaN.isNotZero(); // => true * Infinity.isNotZero(); // => true * -Infinity.isNotZero(); // => true * ``` */ isNonzero(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is odd. * * @example * ```typescript * (3).isOdd(); // => true * (4).isOdd(); // => false * 3.0.isOdd(); // => true * 1.95.isOdd(); // => false * ``` */ isOdd(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is positive (using `Math.sign`). * * @example * ```typescript * 1.95.isPositive(); // => true * -1.95.isPositive(); // => false * NaN.isPositive(); // => false * Infinity.isPositive(); // => true * -Infinity.isPositive(); // => false * ``` * * @see {@link Math.sign} */ isPositive(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is a safe integer (using `Number.isSafeInteger`). * * @example * ```typescript * 1.95.isSafeInteger(); // => true * NaN.isSafeInteger(); // => false * Infinity.isSafeInteger(); // => false * -Infinity.isSafeInteger(); // => false * Number.MAX_SAFE_INTEGER.isSafeInteger(); // => true * (Number.MAX_SAFE_INTEGER + 1).isSafeInteger(); // => false * ``` */ isSafeInteger(): boolean; } } declare global { interface Number { /** * Returns `true` if the number is zero. * * @example * ```typescript * 1.95.isZero(); // => false * (0).isZero(); // => true * (-0).isZero(); // => true * ``` */ isZero(): this is 0; } } declare global { interface Number { /** * Returns a supplied numeric expression rounded to the nearest integer (using `Math.round`). * * @example * ```typescript * 1.95.round(); // => 2 * 1.5.round(); // => 2 * 1.05.round(); // => 1 * (3).round(); // => 3 * (-1.95).round(); // => -2 * (-1.5).round(); // => -1 * (-1.05).round(); // => -1 * ``` * * @see {@link Math.round} */ round(): number; } } declare global { interface Number { /** * The sign of the number, indicating whether x is positive, negative or zero (using `Math.sign`). * * @example * ```typescript * 1.95.sign; // => 1 * (-2).sign; // => -1 * (0).sign; // => 0 * (-0).sign; // => -0 * NaN.sign; // => NaN * Infinity.sign; // => 1 * (-Infinity).sign; // => -1 * ``` */ readonly sign: number; } } declare global { interface Number { /** * Calls the given function with times of the number. * @param callbackfn The function to call. * * @example * ```typescript * (3).times((index) => console.log(index, 'Hello, world!')); * // 0 Hello, world! * // 1 Hello, world! * // 2 Hello, world! * ``` */ times(callbackfn: (index?: number) => unknown): void; } } declare global { interface Number { /** * Returns the character represented by the Unicode value of the number (using `String.fromCharCode`). * * @example * ```typescript * 65.toChar(); // => 'A' * 97.toChar(); // => 'a' * ``` * * @see {@link String.fromCharCode} */ toChar(): string; } } declare global { interface Number { /** * Returns a string representation of the number by `format`. * If `format` is not available, it will fallback to `String#toString`. * * **Note:** This method returns the locale specific string representation of the number. * If you want to get the string representation of the number in a specific locale, * pass the `locale` option to the `options` parameter, e.g. `(123).toFormattedString('currency', { locale: 'zh-CN' })`. * @param format - The format of the string representation. * @param options - The options for formatting the string representation. * * @example * ```typescript * // Returns a string representation of the number as a currency * 1234567890.50.toFormattedString('currency'); // => '$1,234,567,890.50' * 1234567890.506.toFormattedString('currency'); // => '$1,234,567,890.51' * 1234567890.506.toFormattedString('currency', { precision: 3 }); // => '$1,234,567,890.506' * ``` * * @example * ```typescript * // Returns a string representation of a number in delimited form * (12345678).toFormattedString('delimited'); // => '12,345,678' * 12345678.05.toFormattedString('delimited'); // => '12,345,678.05' * (12345678).toFormattedString('delimited', { delimiter: '.' }); // => '12.345.678' * (12345678).toFormattedString('delimited', { delimiter: ',' }); // => '12,345,678' * 12345678.05.toFormattedString('delimited', { separator: ' ' }); // => '12,345,678 05' * ``` * * @example * ```typescript * // Returns a string representation of a number as a human-readable number of bytes * (123).toFormattedString('human-size'); // => 123 Bytes * (1234).toFormattedString('human-size'); // => 1.21 KB * (12345).toFormattedString('human-size'); // => 12.1 KB * (1234567).toFormattedString('human-size'); // => 1.18 MB * (1234567890).toFormattedString('human-size'); // => 1.15 GB * (1234567890123).toFormattedString('human-size'); // => 1.12 TB * (1234567890123456).toFormattedString('human-size'); // => 1.1 PB * ``` * * @example * ```typescript * // Returns a string representation of a number as a percentage * (100).toFormattedString('percentage'); // => '100.000%' * (100).toFormattedString('percentage', { precision: 0 }); // => '100%' * (1000).toFormattedString('percentage', { delimiter: '.', separator: ',' }); // => '1.000,000%' * 302.24398923423.toFormattedString('percentage', { precision: 5 }); // => '302.24399%' *``` * * @example * ```typescript * // Returns a string representation of the number as a telephone number * (5551234).toFormattedString('phone'); // => '555-1234' * (1235551234).toFormattedString('phone'); // => '123-555-1234' * (1235551234).toFormattedString('phone', { areaCode: true }); // => '(123) 555-1234' * (1235551234).toFormattedString('phone', { delimiter: ' ' }); // => '123 555 1234' * (1235551234).toFormattedString('phone', { areaCode: true, extension: 555 }); // => '(123) 555-1234 x 555' * (1235551234).toFormattedString('phone', { countryCode: 1 }); // => '+1-123-555-1234' * ``` * * @example * ```typescript * // Returns a string representation of a number rounded to a precision * 111.2345.toFormattedString('rounded'); // => '111.235' * 111.2345.toFormattedString('rounded', { precision: 2 }); // => '111.23' * (13).toFormattedString('rounded', { precision: 5 }); // => '13.00000' * 389.32314.toFormattedString('rounded', { precision: 0 }); // => '389' * 111.2345.toFormattedString('rounded', { significant: true }); // => '111' * ``` */ toFormattedString( format: 'currency', options?: FormatCurrencyOptions, ): string; toFormattedString( format: 'delimited', options?: FormatDelimitedOptions, ): string; toFormattedString( format: 'human-size', options?: FormatHumanSizeOptions, ): string; toFormattedString( format: 'percentage', options?: FormatPercentageOptions, ): string; toFormattedString(format: 'phone', options?: FormatPhoneOptions): string; toFormattedString( format: 'rounded', options?: FormatRoundedOptions, ): string; toFormattedString(format: string, options?: object): string; } } declare global { interface Number { /** * Returns the integral part of the number, removing any fractional digits (using `Math.trunc`). * If number is already an integer, the result is number. * * @example * ```typescript * 13.37.trunc(); // => 13 * 42.84.trunc(); // => 42 * 0.123.trunc(); // => 0 * -0.123.trunc(); // => -0 * ``` * * @see {@link Math.trunc} */ trunc(): number; } } declare global { interface ObjectConstructor { /** * Returns an array of key/values of the enumerable properties of an object (using `Object.entries`, but with stricter TypeScript typings). * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * * @example * ```typescript * const obj = { a: 1, b: 2, c: true, 5: 42, [Symbol()]: 'symbol' }; * Object.entriesS(obj); // => [['5', 42], ['a', 1], ['b', 2], ['c', true]] * const entries = Object.entriesS(obj); // entries :: (['5', number] | ['a', number] | ['b', number] | ['c', boolean])[] * ``` * * @see {@link Object.entries} */ entriesS(o: T): StrictEntries; } } declare global { interface ObjectConstructor { /** * Calls a defined callback function on each enumerable key/value pair of an object, and returns an object that contains results meeting the condition specified in the callback function. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param predicate A function that accepts up to three arguments. The filter function calls the predicate function one time for each key/value pair in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * Object.filter(obj, ([key, value]) => key === 'a' || value === 42); // => { 5: 42, a: 1 } * const filtered = Object.filter(obj, ([key, value]) => key === 'a' || value === 42); // filtered :: { 5?: number | undefined, a?: number | undefined, b?: number | undefined } * ``` */ filter( o: O, predicate: ( entry: StrictEntries[number], index: number, object: O, ) => boolean, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any, ): { // @ts-expect-error - `P` should be keyof `O` but TS cannot infer it [P in StrictKeys[number]]?: O[P]; }; } } declare global { interface ObjectConstructor { /** * Returns `true` if the value is an empty object. An object is considered empty unless it’s an arguments object, array, or * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. * @param o — The value to check. * * @example * ```typescript * isEmpty({}); // => true * isEmpty({ a: 1 }); // => false * isEmpty([1, 2, 3]); // => false * isEmpty([]); // => true * isEmpty(new Map()); // => true * isEmpty(new Set()); // => true * ``` */ isEmpty( o: Map | Set | ArrayLike, ): boolean; isEmpty(o: object): boolean; } } declare global { interface ObjectConstructor { /** * Returns the names of the enumerable string properties and methods of an object (using `Object.keys`, but with stricter TypeScript typings). * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * Object.keysS(obj); // => ['5', 'a', 'b', 'c'] * const keys = Object.strictKeys(obj); // keys :: ('5' | 'a' | 'b' | 'c')[] * ``` * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * for (const key of Object.keysS(obj)) { * console.log(obj[key]); // No type error * } * ``` * * @see {@link Object.keys} */ keysS(o: T): StrictKeys; } } declare global { interface ObjectConstructor { /** * Calls a defined callback function on each enumerable key/value pair of an object, and returns an object that contains the results. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param callbackfn A function that accepts up to three arguments. The map function calls the callbackfn function one time for each key/value pair in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * Object.map(obj, ([key, value]) => [`${key}_`, value * 2]); // => { '5_': 84, 'a_': 2, 'b_': 4 } * const mapped = Object.map(obj, ([key, value]) => [`${key}_`, value * 2]); // mapped :: { '5_': number, 'a_': number, 'b_': number } * ``` */ map( o: O, callbackfn: ( entry: StrictEntries[number], index: number, object: O, ) => R, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any, ): { [P in R[0]]: R[1] }; } } declare global { interface ObjectConstructor { /** * Calls a defined callback function on each enumerable key of an object, and returns an object that contains the results. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param callbackfn A function that accepts up to three arguments. The mapKeys function calls the callbackfn function one time for each key in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * Object.mapKeys(obj, (key) => `${key}_`); // => { '5_': 42, 'a_': 1, 'b_': 2 } * const mapped = Object.mapKeys(obj, (key) => `${key}_`); // mapped :: { '5_': number, 'a_': number, 'b_': number } * ``` */ mapKeys( o: O, callbackfn: (key: StrictKeys[number], index: number, object: O) => R, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any, ): { [P in R]: StrictValues[number] }; } } declare global { interface ObjectConstructor { /** * Calls a defined callback function on each enumerable value of an object, and returns an object that contains the results. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param callbackfn A function that accepts up to three arguments. The mapValues function calls the callbackfn function one time for each value in the object. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. * * @example * ```typescript * const obj = { a: 1, b: 2, 5: 42, [Symbol()]: 'symbol' }; * Object.mapValues(obj, (value) => value * 2); // => { '5': 84, 'a': 2, 'b': 4 } * const mapped = Object.mapValues(obj, (value) => value * 2); // mapped :: { '5': number, 'a': number, 'b': number } * ``` */ mapValues( o: O, callbackfn: ( value: StrictValues[number], index: number, object: O, ) => R, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any, ): { [P in StrictKeys[number]]: R }; } } declare global { interface ObjectConstructor { /** * Returns an object composed of the own and inherited enumerable properties of the object that are not omitted. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param keys The property names or paths to omit. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [3, 4, 5] }, e: 6 }; * Object.omit(obj, 'a', 'b'); // => { c: { d: [3, 4, 5] }, e: 6 } * Object.omit(obj, path('c.d')); // => { a: 1, b: 2, c: {}, e: 6 } * Object.omit(obj, prop('e'), 'a', path('c.d[1]')); // => { b: 2, c: { d: [3, 5] } } * ``` */ omit< const O extends object, const P extends keyof O | typeof omitPropFallback, const PP extends BasePath | BasePathArray = never, >( o: O, // @ts-expect-error - P must be keyof O, since emitPropFallback is not exported ...keys: readonly (P | PropFn | PathFn)[] ): [PP] extends [never] ? typeof omitPropFallback extends P ? O : Omit : OmitByPath, PP>; } } declare global { interface ObjectConstructor { /** * Calls a defined callback function on each enumerable key/value pair of an object. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param callbackfn A function that accepts up to four arguments. The reduce function calls the callbackfn function one time for each key/value pair in the object. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an object value. * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3 }; * Object.reduce(obj, (acc, [key, value]) => acc + value, 0); // => 6 * ``` */ reduce( o: O, callbackfn: ( previousValue: StrictValues[number], currentEntry: StrictEntries[number], currentIndex: number, object: O, ) => StrictValues[number], ): StrictValues[number]; reduce( o: O, callbackfn: ( previousValue: R, currentEntry: StrictEntries[number], currentIndex: number, object: O, ) => R, initialValue: R, ): R; } } declare global { interface ObjectConstructor { /** * Returns the number of enumerable properties and methods of the object or the `length` property of the object if it is an array-like object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * * @example * ```typescript * Object.size({ a: 1, b: 2, c: 3 }); // => 3 * Object.size({ length: 3 }); // => 3 * Object.size(new Map([['a', 1], ['b', 2], ['c', 3]])); // => 3 * Object.size(new Set([1, 2, 3, 4])); // => 4 * ``` */ size(o: O): Size; } } declare global { interface ObjectConstructor { /** * Returns an array of values of the enumerable properties of an object (using `Object.values`, but with stricter TypeScript typings). * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * * @example * ```typescript * const obj = { a: 1, b: 2, c: 3, 5: 42, [Symbol()]: 'symbol' }; * Object.valuesS(obj); // => [42, 1, 2, 3] * const values = Object.valuesS(obj); // values :: number[] * ``` * * @see {@link Object.values} */ valuesS(o: T): StrictValues; } } declare global { interface ObjectConstructor { with: { /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param prop Property name or `prop` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.with(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.with(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ < O extends object, const K extends { [P in keyof O]: O[P] extends PropertyKey ? P : never; }[keyof O], >( o: O, prop: K | PropFn, value: O[K], ): O; /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.with(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.with(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ | BasePathArray>( o: O, path: PathFn, value: Obj.Get< O, Path extends List ? Path : never >, ): O; /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.with(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.with(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.with(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ >( o: O, path: PP, value: Obj.Get< O, Path extends List ? Path : never >, ): O; }; } } declare global { interface ObjectConstructor { withW: { /** * Returns a new object with the specified property set to the given value. * * It is the same as `Object.with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param prop Property name or `prop` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.withW(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.withW(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link Object.with} */ ( o: O, // eslint-disable-next-line @typescript-eslint/no-explicit-any prop: K | PropFn, value: V, ): Obj.With>; /** * Returns a new object with the specified property set to the given value. * * It is the same as `Object.with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.withW(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.withW(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link Object.with} */ < O extends object, const PP extends string | readonly PropertyKey[], const V, >( o: O, // eslint-disable-next-line @typescript-eslint/no-explicit-any path: PathFn, value: V, ): Obj.With, Obj.WritableDeep>; /** * Returns a new object with the specified property set to the given value. * * It is the same as `Object.with`, but with looser type restrictions. The `W` postfix stands for "wide". * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * Object.withW(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * Object.withW(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * Object.withW(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` * * @see {@link Object.with} */ ( o: O, path: PP, value: V, ): Obj.With, Obj.WritableDeep>; }; } } declare global { /** * An iterable object representing a range of numbers. */ interface Range extends ReadonlyArray { /** * Start of the range. */ readonly start: number; /** * End of the range (exclusive). */ readonly end: number; /** * Step size of the range. */ readonly step: number; /** * Gets or the length of the range. */ readonly length: number; readonly [Symbol.iterator]: () => IterableIterator; /** * Returns a range with the same start, end, and step. * * @example * ```typescript * const rg = range(2, 5, 2); * rg; // => 2..5 by 2 * rg.clone(); // => 2..5 by 2 * ``` */ readonly clone: () => this; /** * Convert the range to an array. * * @example * ```typescript * range(3).toArray(); // => [0, 1, 2] * range(2, 5).toArray(); // => [2, 3, 4] * range(2, 5, 2).toArray(); // => [2, 4] * range(5, 2, -1).toArray(); // => [5, 4, 3] * ``` */ readonly toArray: () => number[]; /** * Returns a string representation of the range. * * @example * ```typescript * range(3).toString(); // => '0..3' * range(2, 5).toString(); // => '2..5' * range(2, 5, 2).toString(); // => '2..5 by 2' * range(5, 2, -1).toString(); // => '5..2 by -1' * ``` */ readonly toString: () => string; } /** * Returns an iterable object that yields numbers from `start` to `end` (exclusive). * @param start The starting number. * @param end The ending number (exclusive). * @param [step] The step size. * * @example * ```typescript * for (const i of range(2, 5)) { * console.log(i); * // 2 * // 3 * // 4 * } * ``` */ function range(start: number, end: number, step?: number): Range; /** * Returns an iterable object that yields numbers from `0` to `end` (exclusive). * @param end The ending number (exclusive). * * @example * ```typescript * for (const i of range(3)) { * console.log(i); * // 0 * // 1 * // 2 * } * ``` */ function range(end: number): Range; } declare global { interface String { /** * Converts the first character of a string to uppercase. * * @example * ```typescript * 'hello'.capitalize(); // => 'Hello' * ``` */ capitalize(this: S): Capitalize; } } declare global { interface String { /** * Returns the reversed string. * * @example * ```typescript * 'hello'.reverse(); // => 'olleh' * ``` */ reverse(): string; } } declare global { interface String { /** * Removes the minimum indent from a string. * The first and last lines are ignored. * * @example * ```typescript * const str = ` * hello * world * ! * `; * const expected = `hello * world * !`; * str.trimIndent() === expected; // => true * ``` */ trimIndent(): string; } } declare global { interface String { /** * Returns `true` if the string is empty or contains only blank characters. * * @example * ```typescript * ''.isBlank(); // => true * ' '.isBlank(); // => true * 'hello'.isBlank(); // => false * ' hello '.isBlank(); // => false * ``` */ isBlank(): boolean; } } declare global { interface String { /** * Returns `true` if the string is empty. * * @example * ```typescript * ''.isEmpty(); // => true * ' '.isEmpty(); // => false * ``` * * @example * ```typescript * const foo = 'hello'; * if (foo.isEmpty()) { * const bar = foo; // bar :: '' * } * ``` */ isEmpty(): this is ''; } } declare global { interface String { /** * Returns `true` if the string is not empty and contains at least one non-blank character. * * @example * ```typescript * ''.isNotBlank(); // => false * ' '.isNotBlank(); // => false * 'hello'.isNotBlank(); // => true * ' hello '.isNotBlank(); // => true * ``` * * @see {@link String#isBlank} */ isNotBlank(): boolean; } } declare global { interface String { /** * Returns `true` if the string is not empty. * * @example * ```typescript * ''.isNotEmpty(); // => false * ' '.isNotEmpty(); // => true * ``` * * @see {@link String#isEmpty} */ isNotEmpty(this: S): this is Exclude; } } declare global { interface StringConstructor { /** * Returns `true` if value is null, undefined, or an empty string. * * @example * ```typescript * String.isEmpty(null); // => true * String.isEmpty(undefined); // => true * String.isEmpty(''); // => true * String.isEmpty(' '); // => false * String.isEmpty('a'); // => false * String.isEmpty(0); // => false * ``` * * @example * ```typescript * const foo: string | null | '' = null; * if (String.isEmpty(foo)) { * const bar = foo; // bar :: null | '' * } * ``` */ isEmpty(value: unknown): value is null | undefined | ''; } } declare global { interface StringConstructor { /** * Returns `true` if value is not null, undefined, or an empty string. * * @example * ```typescript * String.isNotEmpty(null); // => false * String.isNotEmpty(undefined); // => false * String.isNotEmpty(''); // => false * String.isNotEmpty(' '); // => true * String.isNotEmpty('a'); // => true * String.isNotEmpty(0); // => true * ``` * * @example * ```typescript * const foo: number | null | '' = null; * if (String.isNotEmpty(foo)) { * const bar = foo; // bar :: number * } * ``` * * @see {@link isEmpty} */ isNotEmpty(value: T): value is Exclude; } }