Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hotscript

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hotscript - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

dist/internals/core/impl/MergeArgs.d.ts

4

dist/index.d.ts

@@ -1,2 +0,2 @@

import { Apply, Call, Call2, Eval, Fn, Pipe, PipeRight, _, arg, arg0, arg1, arg2, arg3 } from "./internals/core/Core";
import { Apply, Call, Call2, Call3, Call4, Call5, Eval, Fn, Pipe, PipeRight, Compose, ComposeLeft, Constant, Identity, PartialApply, _, arg, arg0, arg1, arg2, arg3, args } from "./internals/core/Core";
import { Functions } from "./internals/functions/Functions";

@@ -10,2 +10,2 @@ import { Numbers } from "./internals/numbers/Numbers";

import { Match } from "./internals/match/Match";
export { _, arg, arg0, arg1, arg2, arg3, Fn, Pipe, PipeRight, Call, Call2, Apply, Eval, Booleans, Objects, Unions, Strings, Numbers, Tuples, Functions, Match, Booleans as B, Objects as O, Unions as U, Strings as S, Numbers as N, Tuples as T, Functions as F, };
export { _, arg, arg0, arg1, arg2, arg3, args, Fn, Pipe, PipeRight, Call, Call2, Call3, Call4, Call5, Compose, ComposeLeft, Constant, Identity, PartialApply, Apply, Eval, Match, Booleans, Objects, Unions, Strings, Numbers, Tuples, Functions, Booleans as B, Objects as O, Unions as U, Strings as S, Numbers as N, Tuples as T, Functions as F, };
import { Equal, Every, Some } from "../helpers";
import { Fn, unset } from "../core/Core";
import { Functions } from "../functions/Functions";
import { Compose, Fn, PartialApply, unset } from "../core/Core";
export declare namespace Booleans {

@@ -9,3 +8,3 @@ type ExtendsImpl<a, b> = [a] extends [b] ? true : false;

}
export type Extends<a = unset, b = unset> = Functions.PartialApply<ExtendsFn, b extends unset ? [unset, a] : [a, b]>;
export type Extends<a = unset, b = unset> = PartialApply<ExtendsFn, b extends unset ? [unset, a] : [a, b]>;
type NotImpl<a> = a extends true ? false : true;

@@ -15,17 +14,14 @@ interface NotFn extends Fn {

}
export type Not<a = unset> = Functions.PartialApply<NotFn, [a]>;
export type Not<a = unset> = PartialApply<NotFn, [a]>;
interface EqualsFn extends Fn {
return: this["args"] extends [infer a, infer b, ...any] ? Equal<a, b> : never;
}
export type Equals<a = unset, b = unset> = Functions.PartialApply<EqualsFn, [
a,
b
]>;
export type NotEqual<a = unset, b = unset> = Functions.Compose<[
export type Equals<a = unset, b = unset> = PartialApply<EqualsFn, [a, b]>;
export type NotEqual<a = unset, b = unset> = Compose<[
Not,
Functions.PartialApply<EqualsFn, [a, b]>
PartialApply<EqualsFn, [a, b]>
]>;
export type DoesNotExtend<a = unset, b = unset> = Functions.Compose<[
export type DoesNotExtend<a = unset, b = unset> = Compose<[
Not,
Functions.PartialApply<ExtendsFn, [a, b]>
PartialApply<ExtendsFn, [a, b]>
]>;

@@ -39,3 +35,3 @@ interface AndFn extends Fn {

}
export type And<a = unset, b = unset> = Functions.PartialApply<AndFn, [a, b]>;
export type And<a = unset, b = unset> = PartialApply<AndFn, [a, b]>;
interface OrFn extends Fn {

@@ -48,3 +44,3 @@ return: this["args"] extends [

}
export type Or<a = unset, b = unset> = Functions.PartialApply<OrFn, [a, b]>;
export type Or<a = unset, b = unset> = PartialApply<OrFn, [a, b]>;
interface XOrFn extends Fn {

@@ -57,4 +53,4 @@ return: this["args"] extends [

}
export type XOr<a = unset, b = unset> = Functions.PartialApply<XOrFn, [a, b]>;
export type XOr<a = unset, b = unset> = PartialApply<XOrFn, [a, b]>;
export {};
}

@@ -0,1 +1,3 @@

import { MergeArgs } from "./impl/MergeArgs";
import { Head } from "../helpers";
declare const rawArgs: unique symbol;

@@ -177,2 +179,73 @@ type rawArgs = typeof rawArgs;

] ? PipeRight<rest, Call<last, acc>> : acc;
/**
* Returns the the function's first argument.
*
* @param arg0 - The function to extract the first argument from.
* @returns The first argument of the function.
*/
export interface Identity extends Fn {
return: this["arg0"];
}
/**
* A function that returns it's generic parameter.
*
* @param T - The type to return.
* @returns The type `T`.
*/
export interface Constant<T> extends Fn {
return: T;
}
/**
* Composes a list of functions into a single function that passes the result of each function to the next.
* Executes the functions from right to left.
*
* @param fns - The list of functions to compose.
* @returns The composed function.
*
* @example
* ```ts
* type T0 = Call<Compose< [T.Join<'-'>,S.Split<'.'> ]>, 'a.b.c'>; // 'a-b-c'
* ```
*/
export interface Compose<fns extends Fn[]> extends Fn {
return: ComposeImpl<fns, this["args"]>;
}
type ComposeImpl<fns extends Fn[], args extends any[]> = fns extends [
...infer rest extends Fn[],
infer last extends Fn
] ? ComposeImpl<rest, [Apply<last, args>]> : Head<args>;
/**
* Composes a list of functions into a single function that passes the result of each function to the next.
* Executes the functions from left to right.
*
* @param fns - The list of functions to compose.
* @returns The composed function.
*
* @example
* ```ts
* type T0 = Call<ComposeLeft< [S.Split<'.'>,T.Join<'-'> ]>, 'a.b.c'>; // 'a-b-c'
* ```
*/
export interface ComposeLeft<fns extends Fn[]> extends Fn {
return: ComposeLeftImpl<fns, this["args"]>;
}
type ComposeLeftImpl<fns extends Fn[], args extends any[]> = fns extends [
infer first extends Fn,
...infer rest extends Fn[]
] ? ComposeLeftImpl<rest, [Apply<first, args>]> : Head<args>;
/**
* Partially applies the passed arguments to the function and returns a new function.
* The new function will have the applied arguments passed to the original function
*
* @param fn - The function to partially apply.
* @param partialArgs - The arguments to partially apply.
* @returns The partially applied function.
*
* @example
* ```ts
* type T0 = Call<PartialApply<Parameter, [_, (a: number, b: string) => void]>, 1> ; // [b: string]
*/
export interface PartialApply<fn extends Fn, partialArgs extends unknown[]> extends Fn {
return: MergeArgs<this["args"], partialArgs> extends infer args extends unknown[] ? Apply<fn, args> : never;
}
export {};

@@ -1,22 +0,3 @@

import { Apply, Fn, unset, _ } from "../core/Core";
import { MergeArgs } from "./impl/MergeArgs";
import { Fn, PartialApply, unset, _ } from "../core/Core";
export declare namespace Functions {
/**
* Returns the the function's first argument.
*
* @param arg0 - The function to extract the first argument from.
* @returns The first argument of the function.
*/
export interface Identity extends Fn {
return: this["arg0"];
}
/**
* A function that returns it's generic parameter.
*
* @param T - The type to return.
* @returns The type `T`.
*/
export interface Constant<T> extends Fn {
return: T;
}
type ParametersImpl<fn> = fn extends (...args: infer args) => any ? args : never;

@@ -71,57 +52,3 @@ export interface ParametersFn extends Fn {

}
type Head<xs> = xs extends [infer first, ...any] ? first : never;
type ComposeImpl<fns extends Fn[], args extends any[]> = fns extends [
...infer rest extends Fn[],
infer last extends Fn
] ? ComposeImpl<rest, [Apply<last, args>]> : Head<args>;
/**
* Composes a list of functions into a single function that passes the result of each function to the next.
* Executes the functions from right to left.
*
* @param fns - The list of functions to compose.
* @returns The composed function.
*
* @example
* ```ts
* type T0 = Call<Compose< [T.Join<'-'>,S.Split<'.'> ]>, 'a.b.c'>; // 'a-b-c'
* ```
*/
export interface Compose<fns extends Fn[]> extends Fn {
return: ComposeImpl<fns, this["args"]>;
}
type ComposeLeftImpl<fns extends Fn[], args extends any[]> = fns extends [
infer first extends Fn,
...infer rest extends Fn[]
] ? ComposeLeftImpl<rest, [Apply<first, args>]> : Head<args>;
/**
* Composes a list of functions into a single function that passes the result of each function to the next.
* Executes the functions from left to right.
*
* @param fns - The list of functions to compose.
* @returns The composed function.
*
* @example
* ```ts
* type T0 = Call<ComposeLeft< [S.Split<'.'>,T.Join<'-'> ]>, 'a.b.c'>; // 'a-b-c'
* ```
*/
export interface ComposeLeft<fns extends Fn[]> extends Fn {
return: ComposeLeftImpl<fns, this["args"]>;
}
/**
* Partially applies the passed arguments to the function and returns a new function.
* The new function will have the applied arguments passed to the original function
*
* @param fn - The function to partially apply.
* @param partialArgs - The arguments to partially apply.
* @returns The partially applied function.
*
* @example
* ```ts
* type T0 = Call<PartialApply<Parameter, [_, (a: number, b: string) => void]>, 1> ; // [b: string]
*/
export interface PartialApply<fn extends Fn, partialArgs extends unknown[]> extends Fn {
return: MergeArgs<this["args"], partialArgs> extends infer args extends unknown[] ? Apply<fn, args> : never;
}
export {};
}

@@ -24,2 +24,5 @@ export type Equal<a, b> = (<T>() => T extends a ? 1 : 2) extends <T>() => T extends b ? 1 : 2 ? true : false;

} | never;
export type RecursivePrettify<T> = IsArrayStrict<T> extends true ? RecursivePrettify<Extract<T, readonly any[]>[number]>[] : {
[K in keyof T]: RecursivePrettify<T[K]>;
};
export type AnyTuple = readonly [any, ...any];

@@ -75,10 +78,5 @@ export declare namespace Iterator {

export type Split<Str, Sep extends string, Acc extends string[] = []> = Str extends "" ? Acc : Str extends `${infer T}${Sep}${infer U}` ? Split<U, Sep, [...Acc, T]> : [...Acc, Str];
export type GetFromPath<Obj, Path> = RecursiveGet<Obj, ParsePath<Path>>;
type ParsePath<Path, Output extends string[] = [], CurrentChunk extends string = ""> = Path extends number ? [`${Path}`] : Path extends `${infer First}${infer Rest}` ? First extends "." | "[" | "]" ? ParsePath<Rest, [
...Output,
...(CurrentChunk extends "" ? [] : [CurrentChunk])
], ""> : ParsePath<Rest, Output, `${CurrentChunk}${First}`> : [...Output, ...(CurrentChunk extends "" ? [] : [CurrentChunk])];
type RecursiveGet<Obj, PathList> = Obj extends any ? PathList extends [infer First, ...infer Rest] ? First extends keyof Obj ? RecursiveGet<Obj[First], Rest> : [First, Obj] extends [`${number}`, any[]] ? RecursiveGet<Extract<Obj, any[]>[number], Rest> : undefined : Obj : never;
export type Stringifiable = string | number | boolean | bigint | null | undefined;
export type Primitive = string | number | boolean | bigint | null | undefined | symbol;
export type Head<xs> = xs extends [infer first, ...any] ? first : never;
export {};

@@ -1,3 +0,2 @@

import { arg, Eval, Fn, unset } from "../../core/Core";
import { Functions } from "../../functions/Functions";
import { arg, Eval, Fn, PartialApply, unset } from "../../core/Core";
import { Primitive, UnionToIntersection } from "../../helpers";

@@ -35,10 +34,10 @@ type GetWithDefault<Obj, K, Def> = K extends keyof Obj ? Obj[K] : Def;

]>;
export type Match<value, patterns extends With<unknown, any>[]> = patterns extends [
With<infer pattern, infer fn extends Fn>,
...infer restPatterns extends With<unknown, Fn>[]
] ? DoesMatch<value, pattern> extends true ? Eval<Functions.PartialApply<fn, ExtractArgs<value, pattern>>> : Match<value, restPatterns> : never;
export type With<pattern, fn extends Fn> = {
export type Match<value, patterns extends With<any, any>[]> = patterns extends [
With<infer pattern, infer handler>,
...infer restPatterns extends With<any, any>[]
] ? DoesMatch<value, pattern> extends true ? handler extends Fn ? Eval<PartialApply<Extract<handler, Fn>, ExtractArgs<value, pattern>>> : handler : Match<value, restPatterns> : never;
export type With<pattern, handler> = {
pattern: pattern;
fn: fn;
handler: handler;
};
export {};

@@ -1,3 +0,2 @@

import { Fn, unset, _ } from "../core/Core";
import { Functions } from "../functions/Functions";
import { Fn, PartialApply, unset, _ } from "../core/Core";
import * as Impl from "./impl/match";

@@ -22,3 +21,3 @@ /**

*/
export type Match<valueOrWithClauses = unset, withClauses extends Impl.With<unknown, any>[] | unset | _ = unset> = Functions.PartialApply<MatchFn, withClauses extends unset ? [unset, valueOrWithClauses] : [valueOrWithClauses, withClauses]>;
export type Match<valueOrWithClauses = unset, withClauses extends Impl.With<any, any>[] | unset | _ = unset> = PartialApply<MatchFn, withClauses extends unset ? [unset, valueOrWithClauses] : [valueOrWithClauses, withClauses]>;
interface MatchFn extends Fn {

@@ -28,4 +27,4 @@ return: Impl.Match<this["arg0"], this["arg1"]>;

export declare namespace Match {
type With<pattern, fn extends Fn> = Impl.With<pattern, fn>;
type With<pattern, handler> = Impl.With<pattern, handler>;
}
export {};

@@ -1,4 +0,3 @@

import { Fn, unset, _ } from "../core/Core";
import { Fn, PartialApply, unset, _ } from "../core/Core";
import * as Impl from "./impl/numbers";
import { Functions } from "../functions/Functions";
export declare namespace Numbers {

@@ -17,3 +16,3 @@ /**

*/
export type Add<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<AddFn, [n1, n2]>;
export type Add<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<AddFn, [n1, n2]>;
interface AddFn extends Fn {

@@ -38,3 +37,3 @@ return: this["args"] extends [

*/
export type Sub<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<SubFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Sub<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<SubFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface SubFn extends Fn {

@@ -59,3 +58,3 @@ return: this["args"] extends [

*/
export type Mul<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<MulFn, [n1, n2]>;
export type Mul<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<MulFn, [n1, n2]>;
interface MulFn extends Fn {

@@ -80,3 +79,3 @@ return: this["args"] extends [

*/
export type Div<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<DivFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Div<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<DivFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface DivFn extends Fn {

@@ -101,3 +100,3 @@ return: this["args"] extends [

*/
export type Mod<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<ModFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Mod<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<ModFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface ModFn extends Fn {

@@ -121,3 +120,3 @@ return: this["args"] extends [

*/
export type Negate<n extends number | bigint | _ | unset = unset> = Functions.PartialApply<NegateFn, [n]>;
export type Negate<n extends number | bigint | _ | unset = unset> = PartialApply<NegateFn, [n]>;
interface NegateFn extends Fn {

@@ -137,3 +136,5 @@ return: this["args"] extends [infer a extends number | bigint, ...any] ? Impl.Negate<a> : never;

*/
export type Abs<n extends number | bigint | _ | unset = unset> = Functions.PartialApply<AbsFn, [n]>;
export type Abs<n extends number | bigint | _ | unset = unset> = PartialApply<AbsFn, [
n
]>;
export interface AbsFn extends Fn {

@@ -152,3 +153,3 @@ return: this["args"] extends [infer a extends number | bigint, ...any] ? Impl.Abs<a> : never;

*/
export type Max<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<MaxFn, [n1, n2]>;
export type Max<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<MaxFn, [n1, n2]>;
export interface MaxFn extends Fn {

@@ -167,3 +168,3 @@ return: Impl.Max<Extract<this["arg0"], number | bigint>, Extract<this["arg1"], number | bigint>>;

*/
export type Min<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<MinFn, [n1, n2]>;
export type Min<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<MinFn, [n1, n2]>;
export interface MinFn extends Fn {

@@ -183,3 +184,3 @@ return: Impl.Min<Extract<this["arg0"], number | bigint>, Extract<this["arg1"], number | bigint>>;

*/
export type Power<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<PowerFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Power<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<PowerFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface PowerFn extends Fn {

@@ -205,3 +206,3 @@ return: this["args"] extends [

*/
export type Compare<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<CompareFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Compare<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<CompareFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface CompareFn extends Fn {

@@ -226,3 +227,3 @@ return: this["args"] extends [

*/
export type Equal<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<EqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Equal<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<EqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface EqualFn extends Fn {

@@ -247,3 +248,3 @@ return: this["args"] extends [

*/
export type NotEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<NotEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type NotEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<NotEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface NotEqualFn extends Fn {

@@ -269,3 +270,3 @@ return: this["args"] extends [

*/
export type LessThan<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<LessThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type LessThan<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<LessThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface LessThanFn extends Fn {

@@ -291,3 +292,3 @@ return: this["args"] extends [

*/
export type LessThanOrEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<LessThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type LessThanOrEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<LessThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface LessThanOrEqualFn extends Fn {

@@ -313,3 +314,3 @@ return: this["args"] extends [

*/
export type GreaterThan<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<GreaterThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type GreaterThan<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<GreaterThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface GreaterThanFn extends Fn {

@@ -335,3 +336,3 @@ return: this["args"] extends [

*/
export type GreaterThanOrEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = Functions.PartialApply<GreaterThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type GreaterThanOrEqual<n1 extends number | bigint | _ | unset = unset, n2 extends number | bigint | _ | unset = unset> = PartialApply<GreaterThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface GreaterThanOrEqualFn extends Fn {

@@ -338,0 +339,0 @@ return: this["args"] extends [

@@ -1,18 +0,12 @@

import { GetFromPath, IsArrayStrict, Prettify, Primitive, UnionToIntersection } from "../helpers";
import { Apply, Call, Call2, Fn, unset, _ } from "../core/Core";
import { IsArrayStrict, Prettify } from "../helpers";
import { Call, Call2, Fn, PartialApply, unset, _ } from "../core/Core";
import { Std } from "../std/Std";
import { Strings } from "../strings/Strings";
import { Functions } from "../functions/Functions";
import * as Impl from "./impl/objects";
export declare namespace Objects {
type FromEntriesImpl<entries extends [PropertyKey, any]> = {
[entry in entries as entry[0]]: entry[1];
};
export interface FromEntries extends Fn {
return: FromEntriesImpl<Extract<this["arg0"], [PropertyKey, any]>>;
return: Impl.FromEntries<Extract<this["arg0"], [PropertyKey, any]>>;
}
type EntriesImpl<T> = {
[K in keyof T]: [K, T[K]];
}[keyof T];
export interface Entries extends Fn {
return: EntriesImpl<this["arg0"]>;
return: Impl.Entries<this["arg0"]>;
}

@@ -58,16 +52,55 @@ type MapValuesImpl<T, fn extends Fn> = {

};
export type Pick<key = unset, obj = unset> = Functions.PartialApply<PickFn, [
key,
obj
]>;
export type Pick<key = unset, obj = unset> = PartialApply<PickFn, [key, obj]>;
interface PickFn extends Fn {
return: PickImpl<this["arg1"], this["arg0"]>;
}
interface ReadonlyFn extends Fn {
return: this["args"] extends [infer value] ? Std._Readonly<value> : never;
}
/**
* Make all properties of an object readonly
* @description This function is used to make properties of an object readonly
* @param value - The object to make properties readonly
* @returns The object with its properties made readonly
* @example
* ```ts
* type T0 = Call<Objects.Readonly, {a: 1; b: true }>; // { readonly a:1; readonly b: true}
* type T1 = Eval<Objects.Readonly<{ a: 1; b: true }>>; // { readonly a:1; readonly b: true}
* ```
*/
export type Readonly<value = unset> = PartialApply<ReadonlyFn, [value]>;
interface RequiredFn extends Fn {
return: this["args"] extends [infer value] ? Std._Required<value> : never;
}
/**
* Make all properties of an object required
* @description This function is used to make properties of an object required
* @param value - The object to make properties required
* @returns The object with its properties made required
* @example
* ```ts
* type T0 = Call<Objects.Required, {a?: 1; b?: true }>; // { a:1; b: true}
* type T1 = Eval<Objects.Required<{ a?: 1; b?: true }>>; // { a:1; b: true}
* ```
*/
export type Required<value = unset> = PartialApply<RequiredFn, [value]>;
interface PartialFn extends Fn {
return: this["args"] extends [infer value] ? Std._Partial<value> : never;
}
/**
* Make all properties of an object optional
* @description This function is used to make properties of an object optional
* @param value - The object to make properties optional
* @returns The object with its properties made optional
* @example
* ```ts
* type T0 = Call<Objects.Partial, {a: 1; b: true }>; // { a?:1; b?: true}
* type T1 = Eval<Objects.Partial<{ a: 1; b: true }>>; // { a?:1; b?: true}
* ```
*/
export type Partial<value = unset> = PartialApply<PartialFn, [value]>;
type OmitImpl<obj, keys> = {
[key in Exclude<keyof obj, keys>]: obj[key];
};
export type Omit<key = unset, obj = unset> = Functions.PartialApply<OmitFn, [
key,
obj
]>;
export type Omit<key = unset, obj = unset> = PartialApply<OmitFn, [key, obj]>;
interface OmitFn extends Fn {

@@ -77,3 +110,3 @@ return: OmitImpl<this["arg1"], this["arg0"]>;

type PickEntriesImpl<entries extends [PropertyKey, any], fn extends Fn> = entries extends any ? Call2<fn, entries[1], entries[0]> extends true ? entries : never : never;
type PickByImpl<T, fn extends Fn> = FromEntriesImpl<PickEntriesImpl<EntriesImpl<T>, fn>>;
type PickByImpl<T, fn extends Fn> = Impl.FromEntries<PickEntriesImpl<Impl.Entries<T>, fn>>;
export interface PickBy<fn extends Fn> extends Fn {

@@ -83,25 +116,14 @@ return: PickByImpl<this["arg0"], fn>;

type OmitEntriesImpl<entries extends [PropertyKey, any], fn extends Fn> = entries extends any ? Call2<fn, entries[1], entries[0]> extends true ? never : entries : never;
type OmitByImpl<T, fn extends Fn> = FromEntriesImpl<OmitEntriesImpl<EntriesImpl<T>, fn>>;
type OmitByImpl<T, fn extends Fn> = Impl.FromEntries<OmitEntriesImpl<Impl.Entries<T>, fn>>;
export interface OmitBy<fn extends Fn> extends Fn {
return: OmitByImpl<this["arg0"], fn>;
}
type AssignImpl<xs extends readonly any[]> = Prettify<UnionToIntersection<xs[number]>>;
export type Assign<arg1 = unset, arg2 = unset, arg3 = unset, arg4 = unset, arg5 = unset> = Functions.PartialApply<AssignFn, [arg1, arg2, arg3, arg4, arg5]>;
export type Assign<arg1 = unset, arg2 = unset, arg3 = unset, arg4 = unset, arg5 = unset> = PartialApply<AssignFn, [arg1, arg2, arg3, arg4, arg5]>;
interface AssignFn extends Fn {
return: AssignImpl<this["args"]>;
return: Impl.Assign<this["args"]>;
}
type GroupByImplRec<xs, fn extends Fn, acc = {}> = xs extends [
infer first,
...infer rest
] ? Call<fn, first> extends infer key extends PropertyKey ? GroupByImplRec<rest, fn, Std._Omit<acc, key> & {
[K in key]: [
...(key extends keyof acc ? Extract<acc[key], readonly any[]> : []),
first
];
}> : never : acc;
type GroupByImpl<xs, fn extends Fn> = Prettify<GroupByImplRec<xs, fn>>;
export interface GroupBy<fn extends Fn> extends Fn {
return: GroupByImpl<this["arg0"], fn>;
return: Impl.GroupBy<this["arg0"], fn>;
}
export type Get<path extends string | number | _ | unset = unset, obj = unset> = Functions.PartialApply<GetFn, [path, obj]>;
export type Get<path extends string | number | _ | unset = unset, obj = unset> = PartialApply<GetFn, [path, obj]>;
export interface GetFn extends Fn {

@@ -112,5 +134,32 @@ return: this["args"] extends [

...any
] ? GetFromPath<obj, path> : never;
] ? Impl.GetFromPath<obj, path> : never;
}
/**
* Updates an object or a tuple type.
* @description This function takes an object, a path to one of its properties,
* a new value or a function to apply to this property, and returns a new version
* of this object with this property updated.
* @param path - the path to the property to update
* @param valueOrFn - a value to set, or a function to apply on the target property
* @param obj - the object to update.
* @returns The updated object.
*
* @example
* ```ts
* type T0 = Call<O.Update<'a', Numbers.Add<1>>, { a: 1, b: 1 }>; // { a: 2, b: 1 }
* type T1 = Call<O.Update<'a[0]', 4>, { a: [1, 2, 3] }>; // { a: [4, 2, 3] }
* type T2 = Call<O.Update<'a.b', Numbers.Add<1>>, { a: { b: 1 }, c: '' }>; // { a: { b: 2 }, c: '' }
* type T3 = Call<O.Update<'a.b', "Hello">, { a: { b: 1 } }>; // { a: { b: "Hello" } }
* ```
*/
export type Update<path extends string | number | _ | unset = unset, fnOrValue = unset, obj = unset> = PartialApply<UpdateFn, [path, fnOrValue, obj]>;
export interface UpdateFn extends Fn {
return: this["args"] extends [
infer path extends string | number,
infer fnOrValue,
infer obj,
...any
] ? Impl.Update<obj, path, fnOrValue> : never;
}
/**
* Create an object from parameters

@@ -128,10 +177,5 @@ * @description This function is used to make an object from parameters

interface CreateFn extends Fn {
return: this["args"] extends [infer pattern, ...infer args] ? CreateImpl<pattern, args> : never;
return: this["args"] extends [infer pattern, ...infer args] ? Impl.Create<pattern, args> : never;
}
type CreateImpl<pattern, args extends unknown[]> = pattern extends infer p extends Fn ? Apply<p, args> : pattern extends Primitive ? pattern : pattern extends [any, ...any] ? {
[key in keyof pattern]: CreateImpl<pattern[key], args>;
} : pattern extends (infer V)[] ? CreateImpl<V, args>[] : pattern extends object ? {
[key in keyof pattern]: CreateImpl<pattern[key], args>;
} : pattern;
export type Create<pattern = unset, arg0 = unset, arg1 = unset, arg2 = unset, arg3 = unset> = Functions.PartialApply<CreateFn, [pattern, arg0, arg1, arg2, arg3]>;
export type Create<pattern = unset, arg0 = unset, arg1 = unset, arg2 = unset, arg3 = unset> = PartialApply<CreateFn, [pattern, arg0, arg1, arg2, arg3]>;
interface RecordFn extends Fn {

@@ -152,4 +196,42 @@ return: this["args"] extends [infer union extends string, infer value] ? Std._Record<union, value> : never;

*/
export type Record<union extends string | _ | unset = unset, value = unset> = Functions.PartialApply<RecordFn, [union, value]>;
export type Record<union extends string | _ | unset = unset, value = unset> = PartialApply<RecordFn, [union, value]>;
/**
* Smarter version of keyof that also works with tuples
* @params args[0] - The type to extract keys from
* @returns An union of all the types's keys
* @example
* ```ts
* type T0 = Call<O.Keys, ['a', 'b', 'c']>; // 0 | 1 | 2
* ```
*/
export interface Keys extends Fn {
return: Impl.Keys<this["arg0"]>;
}
/**
* Smarter version of Values that also works with tuples
* @params args[0] - The type to extract values from
* @returns An union of all the types's values
* @example
* ```ts
* type T0 = Call<O.Values, ['a', 'b', 'c']>; // 'a' | 'b' | 'c'
* ```
*/
export interface Values extends Fn {
return: Impl.Values<this["arg0"]>;
}
/**
* Create a union of all deep paths the object has
* @description This function is used to create a union from an object with keys
* @param obj - The object from which the union will be generated
* @returns An union with all the possible deep paths
*
* @example
* ```ts
* type T0 = Call<O.AllPaths, { a: { b: number } }>; // 'a' | 'a.b'
* ```
*/
export interface AllPaths extends Fn {
return: Impl.AllPaths<this["arg0"]>;
}
export {};
}

@@ -11,2 +11,5 @@ export declare namespace Std {

type _Record<k extends PropertyKey, v> = Record<k, v>;
type _Readonly<a> = Readonly<a>;
type _Required<a> = Required<a>;
type _Partial<a> = Partial<a>;
}

@@ -0,1 +1,9 @@

import { Fn } from "../../core/Core";
export type Replace<Str, From extends string, To extends string> = Str extends string ? Str extends `${infer Before}${From}${infer After}` ? Replace<`${Before}${To}${After}`, From, To> : Str : Str;
export interface ReplaceReducer<To extends string> extends Fn {
return: this["args"] extends [
infer Str extends string,
infer From extends string,
...any
] ? Replace<Str, From, To> : never;
}

@@ -1,2 +0,2 @@

import { Fn, unset, _ } from "../core/Core";
import { Call, ComposeLeft, Fn, PartialApply, unset, _ } from "../core/Core";
import { Std } from "../std/Std";

@@ -6,3 +6,2 @@ import { Tuples } from "../tuples/Tuples";

import * as Impl from "./impl/strings";
import { Functions } from "../functions/Functions";
export declare namespace Strings {

@@ -20,3 +19,3 @@ export type Stringifiable = string | number | boolean | bigint | null | undefined;

*/
export type Length<Str = unset> = Functions.PartialApply<LengthFn, [Str]>;
export type Length<Str = unset> = PartialApply<LengthFn, [Str]>;
/**

@@ -45,3 +44,3 @@ * Get the length of a string.

*/
export type TrimLeft<Sep extends string | _ = " ", Str = unset> = Functions.PartialApply<TrimLeftFn, [Sep, Str]>;
export type TrimLeft<Sep extends string | _ = " ", Str = unset> = PartialApply<TrimLeftFn, [Sep, Str]>;
interface TrimLeftFn extends Fn {

@@ -64,3 +63,3 @@ return: this["args"] extends [

*/
export type TrimRight<Sep extends string | _ = " ", Str = unset> = Functions.PartialApply<TrimRightFn, [Sep, Str]>;
export type TrimRight<Sep extends string | _ = " ", Str = unset> = PartialApply<TrimRightFn, [Sep, Str]>;
interface TrimRightFn extends Fn {

@@ -83,3 +82,6 @@ return: this["args"] extends [

*/
export type Trim<Sep extends string | _ = " ", Str = unset> = Functions.PartialApply<TrimFn, [Sep, Str]>;
export type Trim<Sep extends string | _ = " ", Str = unset> = PartialApply<TrimFn, [
Sep,
Str
]>;
interface TrimFn extends Fn {

@@ -102,3 +104,3 @@ return: this["args"] extends [

*/
export type Replace<from extends string | unset | _ = unset, to extends string | unset | _ = unset, str = unset> = Functions.PartialApply<ReplaceFn, [from, to, str]>;
export type Replace<from extends string | unset | _ = unset, to extends string | unset | _ = unset, str = unset> = PartialApply<ReplaceFn, [from, to, str]>;
interface ReplaceFn extends Fn {

@@ -110,3 +112,3 @@ return: this["args"] extends [

...any
] ? Impl.Replace<Str, From, To> : never;
] ? Call<Tuples.Reduce<Impl.ReplaceReducer<To>, Str>, H.UnionToTuple<From>> : never;
}

@@ -124,3 +126,3 @@ /**

*/
export type Slice<start extends number | unset | _ = unset, end extends number | unset | _ = unset> = Functions.ComposeLeft<[
export type Slice<start extends number | unset | _ = unset, end extends number | unset | _ = unset> = ComposeLeft<[
Strings.Split<"">,

@@ -142,3 +144,3 @@ Tuples.Take<end>,

*/
export type Split<Sep extends string | unset | _ = unset, Str extends string | unset | _ = unset> = Functions.PartialApply<SplitFn, [Sep, Str]>;
export type Split<Sep extends string | unset | _ = unset, Str extends string | unset | _ = unset> = PartialApply<SplitFn, [Sep, Str]>;
export interface SplitFn extends Fn {

@@ -157,3 +159,3 @@ return: this["args"] extends [infer Sep extends string, infer Str, ...any] ? Impl.Split<Str, Sep> : never;

*/
export type Repeat<Times extends number | _ | unset = unset, Str extends string | _ | unset = unset> = Functions.PartialApply<RepeatFn, [Times, Str]>;
export type Repeat<Times extends number | _ | unset = unset, Str extends string | _ | unset = unset> = PartialApply<RepeatFn, [Times, Str]>;
interface RepeatFn extends Fn {

@@ -176,3 +178,3 @@ return: this["args"] extends [

*/
export type StartsWith<Start extends string | _ | unset = unset, Str extends string | _ | unset = unset> = Functions.PartialApply<StartsWithFn, [Start, Str]>;
export type StartsWith<Start extends string | _ | unset = unset, Str extends string | _ | unset = unset> = PartialApply<StartsWithFn, [Start, Str]>;
interface StartsWithFn extends Fn {

@@ -192,3 +194,3 @@ return: this["args"] extends [infer Start extends string, infer Str] ? Str extends `${Start}${string}` ? true : false : never;

*/
export type EndsWith<End extends string | _ | unset = unset, Str extends string | _ | unset = unset> = Functions.PartialApply<EndsWithFn, [End, Str]>;
export type EndsWith<End extends string | _ | unset = unset, Str extends string | _ | unset = unset> = PartialApply<EndsWithFn, [End, Str]>;
interface EndsWithFn extends Fn {

@@ -247,3 +249,3 @@ return: this["args"] extends [infer End extends string, infer Str] ? Str extends `${string}${End}` ? true : false : never;

*/
export type Prepend<Start extends string | _ | unset = unset, Str extends string | _ | unset = unset> = Functions.PartialApply<PrependFn, [Start, Str]>;
export type Prepend<Start extends string | _ | unset = unset, Str extends string | _ | unset = unset> = PartialApply<PrependFn, [Start, Str]>;
interface PrependFn extends Fn {

@@ -262,3 +264,3 @@ return: `${Extract<this["arg0"], Strings.Stringifiable>}${Extract<this["arg1"], Strings.Stringifiable>}`;

*/
export type Append<End extends string | _ | unset = unset, Str extends string | _ | unset = unset> = Functions.PartialApply<AppendFn, [End, Str]>;
export type Append<End extends string | _ | unset = unset, Str extends string | _ | unset = unset> = PartialApply<AppendFn, [End, Str]>;
interface AppendFn extends Fn {

@@ -367,3 +369,3 @@ return: `${Extract<this["arg1"], Strings.Stringifiable>}${Extract<this["arg0"], Strings.Stringifiable>}`;

*/
export type Compare<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = Functions.PartialApply<CompareFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type Compare<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = PartialApply<CompareFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface CompareFn extends Fn {

@@ -390,3 +392,3 @@ return: this["args"] extends [

*/
export type LessThan<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = Functions.PartialApply<LessThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type LessThan<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = PartialApply<LessThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface LessThanFn extends Fn {

@@ -412,3 +414,3 @@ return: this["args"] extends [

*/
export type LessThanOrEqual<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = Functions.PartialApply<LessThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type LessThanOrEqual<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = PartialApply<LessThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface LessThanOrEqualFn extends Fn {

@@ -435,3 +437,3 @@ return: this["args"] extends [

*/
export type GreaterThan<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = Functions.PartialApply<GreaterThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type GreaterThan<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = PartialApply<GreaterThanFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface GreaterThanFn extends Fn {

@@ -458,3 +460,3 @@ return: this["args"] extends [

*/
export type GreaterThanOrEqual<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = Functions.PartialApply<GreaterThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
export type GreaterThanOrEqual<n1 extends string | _ | unset = unset, n2 extends string | _ | unset = unset> = PartialApply<GreaterThanOrEqualFn, n2 extends unset ? [unset, n1] : [n1, n2]>;
interface GreaterThanOrEqualFn extends Fn {

@@ -461,0 +463,0 @@ return: this["args"] extends [

@@ -1,4 +0,3 @@

import { Functions as F, Functions } from "../functions/Functions";
import { Numbers as N, Numbers } from "../numbers/Numbers";
import { Apply, args, Call, Call2, Eval, Fn, Pipe, unset, _ } from "../core/Core";
import { Apply, args, Call, Call2, Eval, Fn, PartialApply, Pipe, unset, _ } from "../core/Core";
import { Iterator, Stringifiable } from "../helpers";

@@ -22,3 +21,3 @@ import { Objects } from "../objects/Objects";

*/
export type At<index extends number | _ | unset = unset, tuple = unset> = Functions.PartialApply<AtFn, [index, tuple]>;
export type At<index extends number | _ | unset = unset, tuple = unset> = PartialApply<AtFn, [index, tuple]>;
interface AtFn extends Fn {

@@ -43,5 +42,3 @@ return: Extract<this["arg1"], readonly any[]>[Extract<this["arg0"], number>];

*/
export type IsEmpty<tuple = unset> = Functions.PartialApply<IsEmptyFn, [
tuple
]>;
export type IsEmpty<tuple = unset> = PartialApply<IsEmptyFn, [tuple]>;
interface ToUnionFn extends Fn {

@@ -60,3 +57,3 @@ return: this["arg0"][number];

*/
export type ToUnion<tuple extends readonly any[] | _ | unset = unset> = Functions.PartialApply<ToUnionFn, [tuple]>;
export type ToUnion<tuple extends readonly any[] | _ | unset = unset> = PartialApply<ToUnionFn, [tuple]>;
/**

@@ -73,3 +70,5 @@ * Returns the first element of a tuple.

*/
export type Head<tuple extends readonly any[] | unset = unset> = Functions.PartialApply<HeadFn, [tuple]>;
export type Head<tuple extends readonly any[] | unset = unset> = PartialApply<HeadFn, [
tuple
]>;
interface HeadFn extends Fn {

@@ -90,3 +89,5 @@ return: HeadImpl<this["arg0"]>;

*/
export type Tail<tuple extends readonly any[] | unset = unset> = Functions.PartialApply<TailFn, [tuple]>;
export type Tail<tuple extends readonly any[] | unset = unset> = PartialApply<TailFn, [
tuple
]>;
export interface TailFn extends Fn {

@@ -107,3 +108,5 @@ return: TailImpl<this["arg0"]>;

*/
export type Last<tuple extends readonly any[] | unset = unset> = Functions.PartialApply<LastFn, [tuple]>;
export type Last<tuple extends readonly any[] | unset = unset> = PartialApply<LastFn, [
tuple
]>;
export interface LastFn extends Fn {

@@ -123,3 +126,3 @@ return: LastImpl<this["arg0"]>;

*/
export type Map<fn extends Fn | unset | _ = unset, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<MapFn, [fn, tuple]>;
export type Map<fn extends Fn | unset | _ = unset, tuple extends readonly any[] | unset = unset> = PartialApply<MapFn, [fn, tuple]>;
interface MapFn extends Fn {

@@ -147,3 +150,3 @@ return: this["args"] extends [

*/
export type FlatMap<fn extends Fn, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<FlatMapFn, [fn, tuple]>;
export type FlatMap<fn extends Fn, tuple extends readonly any[] | unset = unset> = PartialApply<FlatMapFn, [fn, tuple]>;
interface FlatMapFn extends Fn {

@@ -169,3 +172,3 @@ return: ReduceImpl<this["arg1"], [

*/
export type Reduce<fn extends Fn, init = unset, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<ReduceFn, [fn, init, tuple]>;
export type Reduce<fn extends Fn, init = unset, tuple extends readonly any[] | unset = unset> = PartialApply<ReduceFn, [fn, init, tuple]>;
interface ReduceFn extends Fn {

@@ -190,3 +193,3 @@ return: ReduceImpl<this["arg2"], this["arg1"], Extract<this["arg0"], Fn>>;

*/
export type ReduceRight<fn extends Fn, init = unset, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<ReduceRightFn, [fn, init, tuple]>;
export type ReduceRight<fn extends Fn, init = unset, tuple extends readonly any[] | unset = unset> = PartialApply<ReduceRightFn, [fn, init, tuple]>;
interface ReduceRightFn extends Fn {

@@ -209,3 +212,3 @@ return: ReduceRightImpl<this["arg2"], this["arg1"], Extract<this["arg0"], Fn>>;

*/
export type Filter<fn extends Fn, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<FilterFn, [fn, tuple]>;
export type Filter<fn extends Fn, tuple extends readonly any[] | unset = unset> = PartialApply<FilterFn, [fn, tuple]>;
export interface FilterFn extends Fn {

@@ -230,3 +233,3 @@ return: ReduceImpl<this["arg1"], [

*/
export type Find<fn extends Fn, tuple extends readonly any[] | unset = unset> = Functions.PartialApply<FindFn, [fn, tuple]>;
export type Find<fn extends Fn, tuple extends readonly any[] | unset = unset> = PartialApply<FindFn, [fn, tuple]>;
export interface FindFn extends Fn {

@@ -245,3 +248,5 @@ return: FindImpl<this["arg1"], Extract<this["arg0"], Fn>>;

*/
export type Sum<tuple extends readonly any[] | unset = unset> = Functions.PartialApply<SumFn, [tuple]>;
export type Sum<tuple extends readonly any[] | unset = unset> = PartialApply<SumFn, [
tuple
]>;
interface SumFn extends Fn {

@@ -263,3 +268,3 @@ return: ReduceImpl<this["arg0"], 0, N.Add>;

*/
export type Drop<n extends number | unset | _ = unset, tuple = unset> = Functions.PartialApply<DropFn, [n, tuple]>;
export type Drop<n extends number | unset | _ = unset, tuple = unset> = PartialApply<DropFn, [n, tuple]>;
export interface DropFn extends Fn {

@@ -284,3 +289,3 @@ return: this["args"] extends [

*/
export type Take<n extends number | unset | _ = unset, tuple = unset> = Functions.PartialApply<TakeFn, [n, tuple]>;
export type Take<n extends number | unset | _ = unset, tuple = unset> = PartialApply<TakeFn, [n, tuple]>;
interface TakeFn extends Fn {

@@ -304,3 +309,3 @@ return: this["args"] extends [

*/
export type TakeWhile<fn extends Fn, tuple = unset> = Functions.PartialApply<TakeWhileFn, [
export type TakeWhile<fn extends Fn, tuple = unset> = PartialApply<TakeWhileFn, [
fn,

@@ -323,3 +328,3 @@ tuple

*/
export type Some<fn extends Fn, tuple = unset> = Functions.PartialApply<SomeFn, [
export type Some<fn extends Fn, tuple = unset> = PartialApply<SomeFn, [
fn,

@@ -343,3 +348,3 @@ tuple

*/
export type Every<fn extends Fn, tuple = unset> = Functions.PartialApply<EveryFn, [
export type Every<fn extends Fn, tuple = unset> = PartialApply<EveryFn, [
fn,

@@ -354,3 +359,3 @@ tuple

...infer tail
] ? Eval<Tuples.Partition<F.PartialApply<predicateFn, [_, head]>, tail>> extends [infer left extends any[], infer right extends any[]] ? [...SortImpl<left, predicateFn>, head, ...SortImpl<right, predicateFn>] : never : [];
] ? Eval<Tuples.Partition<PartialApply<predicateFn, [_, head]>, tail>> extends [infer left extends any[], infer right extends any[]] ? [...SortImpl<left, predicateFn>, head, ...SortImpl<right, predicateFn>] : never : [];
/**

@@ -388,3 +393,3 @@ * Sort a tuple.

*/
export type Join<Sep extends string | _ | unset = unset, Tuple = unset> = Functions.PartialApply<JoinFn, [Sep, Tuple]>;
export type Join<Sep extends string | _ | unset = unset, Tuple = unset> = PartialApply<JoinFn, [Sep, Tuple]>;
interface JoinFn extends Fn {

@@ -403,3 +408,3 @@ return: this["args"] extends [infer Sep extends string, infer Tuple] ? ReduceImpl<Tuple, "", JoinReducer<Sep>> : never;

*/
export type Prepend<element = unset, tuple = unset> = Functions.PartialApply<PrependFn, [
export type Prepend<element = unset, tuple = unset> = PartialApply<PrependFn, [
element,

@@ -421,3 +426,3 @@ tuple

*/
export type Append<element = unset, tuple = unset> = Functions.PartialApply<AppendFn, [
export type Append<element = unset, tuple = unset> = PartialApply<AppendFn, [
element,

@@ -443,3 +448,3 @@ tuple

*/
export type Partition<fn extends Fn, tuple = unset> = Functions.PartialApply<PartitionFn, [
export type Partition<fn extends Fn, tuple = unset> = PartialApply<PartitionFn, [
fn,

@@ -477,3 +482,3 @@ tuple

*/
export type Zip<arr0 extends unknown[] | _ | unset = unset, arr1 extends unknown[] | _ | unset = unset, arr2 extends unknown[] | _ | unset = unset, arr3 extends unknown[] | _ | unset = unset, arr4 extends unknown[] | _ | unset = unset, arr5 extends unknown[] | _ | unset = unset, arr6 extends unknown[] | _ | unset = unset, arr7 extends unknown[] | _ | unset = unset, arr8 extends unknown[] | _ | unset = unset, arr9 extends unknown[] | _ | unset = unset> = Functions.PartialApply<ZipWith<args>, [
export type Zip<arr0 extends unknown[] | _ | unset = unset, arr1 extends unknown[] | _ | unset = unset, arr2 extends unknown[] | _ | unset = unset, arr3 extends unknown[] | _ | unset = unset, arr4 extends unknown[] | _ | unset = unset, arr5 extends unknown[] | _ | unset = unset, arr6 extends unknown[] | _ | unset = unset, arr7 extends unknown[] | _ | unset = unset, arr8 extends unknown[] | _ | unset = unset, arr9 extends unknown[] | _ | unset = unset> = PartialApply<ZipWith<args>, [
arr0,

@@ -507,3 +512,3 @@ arr1,

*/
export type ZipWith<fn extends Fn, arr0 extends unknown[] | _ | unset = unset, arr1 extends unknown[] | _ | unset = unset, arr2 extends unknown[] | _ | unset = unset, arr3 extends unknown[] | _ | unset = unset, arr4 extends unknown[] | _ | unset = unset, arr5 extends unknown[] | _ | unset = unset, arr6 extends unknown[] | _ | unset = unset, arr7 extends unknown[] | _ | unset = unset, arr8 extends unknown[] | _ | unset = unset, arr9 extends unknown[] | _ | unset = unset> = Functions.PartialApply<ZipWithFn<fn>, [
export type ZipWith<fn extends Fn, arr0 extends unknown[] | _ | unset = unset, arr1 extends unknown[] | _ | unset = unset, arr2 extends unknown[] | _ | unset = unset, arr3 extends unknown[] | _ | unset = unset, arr4 extends unknown[] | _ | unset = unset, arr5 extends unknown[] | _ | unset = unset, arr6 extends unknown[] | _ | unset = unset, arr7 extends unknown[] | _ | unset = unset, arr8 extends unknown[] | _ | unset = unset, arr9 extends unknown[] | _ | unset = unset> = PartialApply<ZipWithFn<fn>, [
arr0,

@@ -534,3 +539,3 @@ arr1,

*/
export type Range<start extends number | _ | unset = unset, end extends number | _ | unset = unset> = Functions.PartialApply<RangeFn, [start, end]>;
export type Range<start extends number | _ | unset = unset, end extends number | _ | unset = unset> = PartialApply<RangeFn, [start, end]>;
interface RangeFn extends Fn {

@@ -537,0 +542,0 @@ return: this["args"] extends [

@@ -1,7 +0,6 @@

import { Call, Eval, Fn, unset, _ } from "../core/Core";
import { Functions } from "../functions/Functions";
import { Call, Eval, Fn, PartialApply, unset, _ } from "../core/Core";
import { Std } from "../std/Std";
import { Tuples } from "../tuples/Tuples";
export declare namespace Unions {
export type Extract<unionOrExtracted = unset, extracted = unset> = Functions.PartialApply<ExtractFn, extracted extends unset ? [unset, unionOrExtracted] : [unionOrExtracted, extracted]>;
export type Extract<unionOrExtracted = unset, extracted = unset> = PartialApply<ExtractFn, extracted extends unset ? [unset, unionOrExtracted] : [unionOrExtracted, extracted]>;
interface ExtractFn extends Fn {

@@ -14,3 +13,3 @@ return: Std._Extract<this["arg0"], this["arg1"]>;

}
export type Exclude<unionOrExcluded = unset, excluded = unset> = Functions.PartialApply<ExcludeFn, excluded extends unset ? [unset, unionOrExcluded] : [unionOrExcluded, excluded]>;
export type Exclude<unionOrExcluded = unset, excluded = unset> = PartialApply<ExcludeFn, excluded extends unset ? [unset, unionOrExcluded] : [unionOrExcluded, excluded]>;
interface ExcludeFn extends Fn {

@@ -24,6 +23,3 @@ return: Std._Exclude<this["arg0"], this["arg1"]>;

type MapImpl<fn extends Fn, union> = union extends any ? Call<fn, union> : never;
export type Map<fn extends Fn, u = unset> = Functions.PartialApply<MapFn, [
fn,
u
]>;
export type Map<fn extends Fn, u = unset> = PartialApply<MapFn, [fn, u]>;
interface MapFn extends Fn {

@@ -46,3 +42,3 @@ return: this["args"] extends [infer fn extends Fn, infer u] ? MapImpl<fn, u> : never;

*/
export type Range<start extends number | _ | unset = unset, end extends number | _ | unset = unset> = Functions.PartialApply<RangeFn, [start, end]>;
export type Range<start extends number | _ | unset = unset, end extends number | _ | unset = unset> = PartialApply<RangeFn, [start, end]>;
interface RangeFn extends Fn {

@@ -49,0 +45,0 @@ return: this["args"] extends [

{
"name": "hotscript",
"version": "1.0.6",
"version": "1.0.7",
"description": "Type-level madness",

@@ -5,0 +5,0 @@ "type": "module",

@@ -59,3 +59,3 @@ # Higher-Order TypeScript (HOTScript)

- [ ] Function
- [ ] Core
- [x] Pipe

@@ -68,2 +68,6 @@ - [x] PipeRight

- [x] ComposeLeft
- [ ] Function
- [x] ReturnType
- [x] Parameters
- [x] Parameter n
- [ ] Tuples

@@ -95,6 +99,6 @@ - [x] Create

- [ ] Object
- [ ] Readonly
- [x] Readonly
- [ ] Mutable
- [ ] Required
- [ ] Partial
- [x] Required
- [x] Partial
- [ ] ReadonlyDeep

@@ -104,3 +108,7 @@ - [ ] MutableDeep

- [ ] PartialDeep
- [x] Update
- [x] Record
- [x] Keys
- [x] Values
- [x] AllPaths
- [x] Create

@@ -107,0 +115,0 @@ - [x] Get

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc