Comparing version 1.57.1 to 1.57.2
@@ -38,3 +38,3 @@ import type { IterableContainer } from "./_types"; | ||
* if its corresponding key does not exist in the `data` object. | ||
* Also, values included in `data` object will not be used | ||
* Also, values included in `data` object will be kept as is | ||
* if its corresponding key does not exist in the `evolver` object. | ||
@@ -41,0 +41,0 @@ * |
import type { IterableContainer } from "./_types"; | ||
type ArraySetRequired<T extends IterableContainer, N extends number, Iteration extends ReadonlyArray<unknown> = []> = Iteration["length"] extends N ? T : T extends readonly [] ? never : T extends [infer Head, ...infer Rest] ? [ | ||
import type { IsNumericLiteral } from "./type-fest/is-literal"; | ||
type ArraySetRequired<T extends IterableContainer, Min extends number, Iteration extends ReadonlyArray<unknown> = []> = number extends Min ? never : Iteration["length"] extends Min ? T : T extends readonly [] ? never : T extends [infer Head, ...infer Rest] ? [ | ||
Head, | ||
...ArraySetRequired<Rest, N, [unknown, ...Iteration]> | ||
] : T extends readonly [infer Head, ...infer Rest] ? readonly [Head, ...ArraySetRequired<Rest, N, [unknown, ...Iteration]>] : T extends Array<infer Item> ? [ | ||
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]> | ||
] : T extends readonly [infer Head, ...infer Rest] ? readonly [ | ||
Head, | ||
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]> | ||
] : T extends Array<infer Item> ? [ | ||
Item, | ||
...ArraySetRequired<T, N, [unknown, ...Iteration]> | ||
...ArraySetRequired<T, Min, [unknown, ...Iteration]> | ||
] : T extends ReadonlyArray<infer Item> ? readonly [ | ||
Item, | ||
...ArraySetRequired<T, N, [unknown, ...Iteration]> | ||
...ArraySetRequired<T, Min, [unknown, ...Iteration]> | ||
] : never; | ||
/** | ||
* Checks if the given array has at least the defined number of elements, and | ||
* refines the output type accordingly so that those indices are defined when | ||
* accessing the array even when using typescript's 'noUncheckedIndexAccess'. | ||
* Checks if the given array has at least the defined number of elements. When | ||
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so | ||
* that those indices are defined when accessing the array even when using | ||
* typescript's 'noUncheckedIndexAccess'. | ||
* | ||
* @param data - The input array. | ||
* @param minimum - The minimum number of elements the array must have. | ||
* @returns True if the array's length is *at least* `minimum`. | ||
* @returns True if the array's length is *at least* `minimum`. When `minimum` | ||
* is a literal value, the output is narrowed to ensure the first items are | ||
* guaranteed. | ||
* @signature | ||
@@ -31,10 +38,14 @@ * R.hasAtLeast(data, minimum) | ||
*/ | ||
export declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: N): data is ArraySetRequired<T, N>; | ||
export declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>; | ||
export declare function hasAtLeast(data: IterableContainer, minimum: number): boolean; | ||
/** | ||
* Checks if the given array has at least the defined number of elements, and | ||
* refines the output type accordingly so that those indices are defined when | ||
* accessing the array even when using typescript's 'noUncheckedIndexAccess'. | ||
* Checks if the given array has at least the defined number of elements. When | ||
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so | ||
* that those indices are defined when accessing the array even when using | ||
* typescript's 'noUncheckedIndexAccess'. | ||
* | ||
* @param minimum - The minimum number of elements the array must have. | ||
* @returns True if the array's length is *at least* `minimum`. | ||
* @returns True if the array's length is *at least* `minimum`. When `minimum` | ||
* is a literal value, the output is narrowed to ensure the first items are | ||
* guaranteed. | ||
* @signature | ||
@@ -54,4 +65,5 @@ * R.hasAtLeast(minimum)(data) | ||
*/ | ||
export declare function hasAtLeast<N extends number>(minimum: N): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>; | ||
export declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>; | ||
export declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean; | ||
export {}; | ||
//# sourceMappingURL=hasAtLeast.d.ts.map |
/** | ||
* A dataLast version of `pipe` that could be used to provide more complex | ||
* computations to functions that except a function as a param (like `map`, | ||
* `filter`, `groupBy`, etc...). | ||
* computations to functions that accept a function as a param (like `map`, | ||
* `filter`, `groupBy`, etc.). | ||
* | ||
@@ -6,0 +6,0 @@ * The first function must be always annotated. Other functions are |
{ | ||
"name": "remeda", | ||
"version": "1.57.1", | ||
"version": "1.57.2", | ||
"description": "A utility library for JavaScript and Typescript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
626288
12685