### Install Dependencies with Yarn Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/README.md Run this command to install all project dependencies using Yarn. ```bash $ yarn ``` -------------------------------- ### Start Local Development Server Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/README.md Starts a local development server for live preview. Changes are reflected without restarting. ```bash $ yarn start ``` -------------------------------- ### Install HOTScript Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Install HOTScript as a development dependency using npm. Expect potential breaking changes as the library is under active development. ```bash npm install -D hotscript ``` -------------------------------- ### Strings.StartsWith, Strings.EndsWith Source: https://context7.com/gvergnaud/hotscript/llms.txt Return `true` or `false` based on whether a string starts or ends with a given prefix/suffix. ```APIDOC ## Strings.StartsWith, Strings.EndsWith ### Description Return `true` or `false` based on whether a string starts or ends with a given prefix/suffix. ### Usage ```ts import { Call, Strings, Tuples } from "hotscript"; type r0 = Call, "https://example.com">; // true type r1 = Call, "index.ts">; // true // Useful in pipelines to filter tuples type r2 = Call< Tuples.Filter>, [ "getUser", "setUser", "getName", "setName" ] >; // ^? ["getUser", "getName"] ``` ``` -------------------------------- ### Objects.Get, Objects.Update Source: https://context7.com/gvergnaud/hotscript/llms.txt Access nested properties using dot-notation paths (Get) or create a new object with updated properties (Update). ```APIDOC ## Objects.Get and Objects.Update ### Description `Get` reads a property at a dot-notation path. `Update` returns a new object with a property set or transformed. ### Usage ```ts import { Call, Objects, Numbers } from "hotscript"; type r0 = Call, { a: { b: 42 } }>; // Expected: 42 type r1 = Call, { a: [1, 2, 3] }>; // Expected: 1 type r2 = Call>, { a: { b: 10 } }>; // Expected: { a: { b: 11 } } type r3 = Call, { a: number }>; // Expected: { a: "hello" } ``` ``` -------------------------------- ### String Pattern Checks: StartsWith and EndsWith Source: https://context7.com/gvergnaud/hotscript/llms.txt Return `true` or `false` based on whether a string starts or ends with a given prefix/suffix. Useful in pipelines for filtering tuples. ```typescript import { Call, Strings, Tuples } from "hotscript"; type r0 = Call, "https://example.com">; // true ``` ```typescript import { Call, Strings, Tuples } from "hotscript"; type r1 = Call, "index.ts">; // true ``` ```typescript import { Call, Strings, Tuples } from "hotscript"; // Useful in pipelines to filter tuples type r2 = Call< Tuples.Filter>, ["getUser", "setUser", "getName", "setName"] >; // ^? ["getUser", "getName"] ``` -------------------------------- ### Build Static Website Content Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/README.md Generates the static website files into the 'build' directory for hosting. ```bash $ yarn build ``` -------------------------------- ### Import Strings Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/strings.md Demonstrates how to import the Strings utility from the hotscript library, either as `Strings` or its alias `S`. ```APIDOC ## Import Strings ### Description Import the `Strings` utility from the `hotscript` library. ### Usage ```ts import { Strings } from "hotscript"; // or import { S } from "hotscript"; ``` ``` -------------------------------- ### Generate Tuple Range with Tuples.Range Source: https://context7.com/gvergnaud/hotscript/llms.txt Produces a tuple of consecutive integers within a specified range. The start and end values must be number literals. ```typescript import { Call, Tuples } from "hotscript"; type r0 = Call, 5>; // ^? [1, 2, 3, 4, 5] type r1 = Call>; // ^? [-2, -1, 0, 1, 2] ``` -------------------------------- ### Importing Functions Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/functions.md Demonstrates the two primary ways to import the Functions utility from the 'hotscript' package. ```APIDOC ## Import ```ts import { Functions } from "hotscript"; // or import { F } from "hotscript"; ``` ``` -------------------------------- ### Import Booleans Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/booleans.md Demonstrates the two ways to import the Booleans utility from the hotscript library. ```APIDOC ## Import Booleans ### Description Shows how to import the `Booleans` utility or its alias `B` from the `hotscript` library. ### Code ```ts import { Booleans } from "hotscript"; // or import { B } from "hotscript"; ``` ``` -------------------------------- ### Importing Objects Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/objects.md Demonstrates how to import the Objects module or its alias 'O' from the hotscript library. ```APIDOC ## Import ```ts import { Objects } from "hotscript"; // or import { O } from "hotscript"; ``` ``` -------------------------------- ### Deploy Website using SSH Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/README.md Deploys the website using SSH, typically for pushing to a hosting branch like gh-pages. ```bash $ USE_SSH=true yarn deploy ``` -------------------------------- ### Import Numbers Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/numbers.md Demonstrates how to import the Numbers utility from the hotscript library, either as 'Numbers' or its alias 'N'. ```APIDOC ## Import ```ts import { Numbers } from "hotscript"; // or import { N } from "hotscript"; ``` ``` -------------------------------- ### PartialApply - Pre-apply arguments to a function Source: https://context7.com/gvergnaud/hotscript/llms.txt Use `PartialApply` to create a new function with some arguments already filled in. The `_` placeholder can be used to defer specific argument positions. ```APIDOC ## PartialApply - Pre-apply arguments to a function ### Description Creates a new `Fn` with some arguments pre-filled. Use `_` as a placeholder to defer specific argument positions. ### Usage ```ts import { Call, PartialApply, Fn, _ } from "hotscript"; interface Append extends Fn { return: [...this["arg1"], this["arg0"]]; } type Append1 = PartialApply; type r0 = Call; // ^? [0, 1] type AppendTo123 = PartialApply; type r1 = Call; // ^? [1, 2, 3, 4] ``` ``` -------------------------------- ### Pre-apply Arguments with PartialApply Source: https://context7.com/gvergnaud/hotscript/llms.txt Use `PartialApply` to create a new `Fn` with some arguments pre-filled. The `_` placeholder defers argument positions. This enables creating specialized versions of functions. ```typescript import { Call, PartialApply, Fn, _ } from "hotscript"; interface Append extends Fn { return: [...this["arg1"], this["arg0"]]; } type Append1 = PartialApply; type r0 = Call; // ^? [0, 1] type AppendTo123 = PartialApply; type r1 = Call; // ^? [1, 2, 3, 4] ``` -------------------------------- ### Import Strings Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/strings.md Import the Strings utilities from the hotscript library. You can use either the full `Strings` name or the alias `S`. ```typescript import { Strings } from "hotscript"; // or import { S } from "hotscript"; ``` -------------------------------- ### Apply - Call a function with a tuple of arguments Source: https://context7.com/gvergnaud/hotscript/llms.txt The `Apply` utility is similar to `Call`, but it accepts its arguments as a single tuple instead of variadic parameters. ```APIDOC ## Apply - Call a function with a tuple of arguments ### Description Like `Call` but takes arguments as a tuple instead of variadic parameters. ### Usage ```ts import { Apply, Numbers } from "hotscript"; type r0 = Apply; // ^? 3 ``` ``` -------------------------------- ### Import Tuples Utility Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/tuples.md Demonstrates how to import the Tuples utility from the hotscript library. You can import the entire Tuples object or use the alias T. ```typescript import { Tuples } from "hotscript"; // or import { T } from "hotscript"; ``` -------------------------------- ### Import Booleans Utility Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/booleans.md Demonstrates how to import the Booleans utility from the hotscript library. You can import the full utility or use the alias 'B'. ```typescript import { Booleans } from "hotscript"; ``` ```typescript // or import { B } from "hotscript"; ``` -------------------------------- ### Strings.Prepend, Strings.Append, Strings.Repeat, Strings.Slice Source: https://context7.com/gvergnaud/hotscript/llms.txt Prepend or append string literals, repeat a string N times, or extract a slice by index range. ```APIDOC ## Strings.Prepend, Strings.Append, Strings.Repeat, Strings.Slice ### Description Prepend or append string literals, repeat a string N times, or extract a slice by index range. ### Usage ```ts import { Call, Strings } from "hotscript"; type r0 = Call, "World">; // "Hello, World" type r1 = Call, "Hello">; // "Hello!" type r2 = Call, "ab">; // "ababab" type r3 = Call, "hello">; // "ell" ``` ``` -------------------------------- ### Compose and ComposeLeft - Compose functions into one Source: https://context7.com/gvergnaud/hotscript/llms.txt These utilities compose multiple functions into a single new function. `Compose` executes functions from right to left, while `ComposeLeft` executes them from left to right. ```APIDOC ## Compose and ComposeLeft - Compose functions into one ### Description `Compose` executes functions right-to-left; `ComposeLeft` executes them left-to-right. Both return a new composable `Fn`. ### Usage ```ts import { Call, Compose, ComposeLeft, Tuples, Strings } from "hotscript"; // Compose: right-to-left type r0 = Call, Strings.Split<".">]>, "a.b.c">; // ^? "a-b-c" // ComposeLeft: left-to-right type r1 = Call, Tuples.Join<"-">]>, "a.b.c">; // ^? "a-b-c" ``` ``` -------------------------------- ### Deploy Website without SSH Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/README.md Deploys the website without using SSH, requiring your GitHub username. ```bash $ GIT_USER= yarn deploy ``` -------------------------------- ### Core Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Core utilities for type-level programming, including piping, composition, and argument access. ```APIDOC ## Pipe ### Description Pipes a type through several functions. ### Usage `Pipe` ``` ```APIDOC ## PipeRight ### Description Pipes a type from right to left. ### Usage `PipeRight` ``` ```APIDOC ## Call ### Description Calls a type-level `Fn` function with provided arguments. ### Usage `Call` ``` ```APIDOC ## Apply ### Description Applies several arguments to an `Fn` function. ### Usage `Apply` ``` ```APIDOC ## PartialApply ### Description Makes an `Fn` function partially applicable. ### Usage `PartialApply` ``` ```APIDOC ## Compose ### Description Composes `Fn` functions from right to left. ### Usage `Compose` ``` ```APIDOC ## ComposeLeft ### Description Composes `Fn` functions from left to right. ### Usage `ComposeLeft` ``` ```APIDOC ## args, arg0, arg1, arg2, arg3 ### Description Accesses piped parameters. Useful in combination with `Objects.Create`. ### Usage `args`, `arg0`, `arg1`, `arg2`, `arg3` ``` ```APIDOC ## _ ### Description Placeholder to partially apply any built-in functions, or functions created with `PartialApply`. ### Usage `_` ``` -------------------------------- ### Objects.CamelCase, Objects.SnakeCase, Objects.KebabCase Source: https://context7.com/gvergnaud/hotscript/llms.txt Rename object keys to different casing conventions (CamelCase, SnakeCase, KebabCase), with Deep variants for nested objects. ```APIDOC ## Objects.CamelCase, Objects.SnakeCase, Objects.KebabCase ### Description Convert all object keys to a given naming convention, with `Deep` variants for nested objects. ### Usage ```ts import { Call, Objects } from "hotscript"; type r0 = Call; // Expected: { current_user: { first_name: string } } type r1 = Call; // Expected: { currentUser: { firstName: string } } type r2 = Call; // Expected: { "user-name": "Bob" } ``` ``` -------------------------------- ### Strings.Uppercase, Strings.Lowercase, Strings.Capitalize, Strings.CamelCase, Strings.SnakeCase, Strings.KebabCase Source: https://context7.com/gvergnaud/hotscript/llms.txt Convert string literal types to various casing conventions. ```APIDOC ## Strings.Uppercase, Strings.Lowercase, Strings.Capitalize, Strings.CamelCase, Strings.SnakeCase, Strings.KebabCase ### Description Convert string literal types to various casing conventions. ### Usage ```ts import { Call, Strings } from "hotscript"; type r0 = Call; // "HELLO" type r1 = Call; // "Hello" type r2 = Call; // "hello_world" type r3 = Call; // "helloWorld" type r4 = Call; // "hello-world" ``` ``` -------------------------------- ### Objects.FromEntries, Objects.Entries Source: https://context7.com/gvergnaud/hotscript/llms.txt Convert between object types and unions of key-value tuple entries. ```APIDOC ## Objects.FromEntries and Objects.Entries ### Description `FromEntries` builds an object from a union of `[key, value]` tuples. `Entries` extracts such a union from an object. ### Usage ```ts import { Call, Objects } from "hotscript"; type r0 = Call; // Expected: { a: 1; b: true } type r1 = Call; // Expected: ["a", 1] | ["b", true] ``` ``` -------------------------------- ### Strings.Split, Strings.Join, Strings.Replace Source: https://context7.com/gvergnaud/hotscript/llms.txt Split a string by separator into a tuple, join a tuple of strings, or replace substrings. ```APIDOC ## Strings.Split, Strings.Join, Strings.Replace ### Description Split a string by separator into a tuple, join a tuple of strings, or replace substrings. ### Usage ```ts import { Call, Strings, Tuples } from "hotscript"; type r0 = Call, "a.b.c">; // ^? ["a", "b", "c"] type r1 = Call, "a.b.c.d">; // ^? "a/b/c/d" ``` ``` -------------------------------- ### String Conversion Utilities Source: https://context7.com/gvergnaud/hotscript/llms.txt Convert between string, number, and tuple literal types. Requires 'Strings' and 'Call' from 'hotscript'. ```typescript import { Call, Strings } from "hotscript"; type r0 = Call; // 42 ``` ```typescript import { Call, Strings } from "hotscript"; type r1 = Call; // "42" ``` ```typescript import { Call, Strings } from "hotscript"; type r2 = Call; // 5 ``` ```typescript import { Call, Strings } from "hotscript"; type r3 = Call; // ["a", "b", "c"] ``` -------------------------------- ### Type-Level Pattern Matching with HOTScript Match Source: https://context7.com/gvergnaud/hotscript/llms.txt Perform type-level pattern matching using Match.With. Supports simple value matching, structural matching with argument extraction, and integration within pipelines. ```typescript import { Match, Pipe, Strings, Call, Fn } from "hotscript"; // Simple value matching type HttpStatus = Match, Match.With<404, "Not Found">, Match.With<500, "Internal Server Error"> Match.With ]>; type r0 = HttpStatus<200>; // "OK" type r1 = HttpStatus<404>; // "Not Found" type r2 = HttpStatus<418>; // "Unknown Status" // Structural matching with extraction type GetMessage = Match>, Match.With>, Match.With ]>; type r3 = GetMessage<{ msg: "hello" }>; // "Message: hello" type r4 = GetMessage<"world">; // "world (string)" // Match inside a Pipe type ParseRoute = Pipe< "/users//posts/", [ Strings.Split<"/">, Tuples.Filter>, Tuples.Map">, Strings.Split<":">]>>, Tuples.ToUnion, Objects.FromEntries, Objects.MapValues< Match<[Match.With<"string", string>, Match.With<"number", number>]> > ] >; // ^? { id: string; index: number } ``` -------------------------------- ### Import Objects Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/objects.md Import the Objects utility from hotscript. You can import the entire namespace as 'Objects' or use the common alias 'O'. ```typescript import { Objects } from "hotscript"; ``` ```typescript // or import { O } from "hotscript"; ``` -------------------------------- ### Object Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Utilities for transforming and querying object types. ```APIDOC ## Readonly ### Description Makes all object keys `readonly`. ### Usage `Readonly` ``` ```APIDOC ## Mutable ### Description Removes `readonly` from all object keys. ### Usage `Mutable` ``` ```APIDOC ## Required ### Description Makes all keys required. ### Usage `Required` ``` ```APIDOC ## Partial ### Description Makes all keys optional. ### Usage `Partial` ``` ```APIDOC ## ReadonlyDeep ### Description Recursively makes all object keys `readonly`. ### Usage `ReadonlyDeep` ``` ```APIDOC ## MutableDeep ### Description Recursively removes `readonly` from all object keys. ### Usage `MutableDeep` ``` ```APIDOC ## RequiredDeep ### Description Recursively makes all keys required. ### Usage `RequiredDeep` ``` ```APIDOC ## PartialDeep ### Description Recursively makes all keys optional. ### Usage `PartialDeep` ``` ```APIDOC ## Update ### Description Immutably updates an object's field under a certain path. Paths are dot-separated strings: `a.b.c`. ### Usage `Update` ``` ```APIDOC ## Record ### Description Creates an object type with keys of type `Key` and values of type `Value`. ### Usage `Record` ``` ```APIDOC ## Keys ### Description Extracts the keys from an object type `Obj`. ### Usage `Keys` ``` ```APIDOC ## Values ### Description Extracts the values from an object type `Obj`. ### Usage `Values` ``` -------------------------------- ### Import Functions API Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/functions.md Import the Functions API using either its full name or its alias 'F'. Choose the import style that best suits your project's conventions. ```typescript import { Functions } from "hotscript"; ``` ```typescript // or import { F } from "hotscript"; ``` -------------------------------- ### Importing Unions Utility Source: https://github.com/gvergnaud/hotscript/blob/main/docusaurus/docs/api/unions.md Import the Unions utility from the hotscript library. You can use the full name 'Unions' or the alias 'U'. ```typescript import { Unions } from "hotscript"; ``` ```typescript // or import { U } from "hotscript"; ``` -------------------------------- ### Transform List with HOTScript Pipe Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Demonstrates transforming a tuple of numbers through various operations like mapping, joining, splitting, and summing using the Pipe utility and HOTScript functions. ```typescript import { Pipe, Tuples, Strings, Numbers } from "hotscript"; type res1 = Pipe< // ^? 62 [1, 2, 3, 4], [ Tuples.Map>, // [4, 5, 6, 7] Tuples.Join<".">, // "4.5.6.7" Strings.Split<".">, // ["4", "5", "6", "7"] Tuples.Map>, // ["14", "15", "16", "17"] Tuples.Map, // [14, 15, 16, 17] Tuples.Sum // 62 ] >; ``` -------------------------------- ### Object Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Utilities for manipulating object types, including path extraction, creation, value retrieval, entry conversion, mapping, merging, picking, omitting, and case conversion. ```APIDOC ## AllPaths ### Description Extracts all possible paths of an object type `Obj`. ### Type Parameters - **Obj**: The object type from which to extract paths. ### Usage `AllPaths` ``` ```APIDOC ## Create ### Description Creates an object of type `Pattern` with values of type `X`. ### Type Parameters - **Pattern**: The pattern object type to create. - **X**: The type of values to use. ### Usage `Create` ``` ```APIDOC ## Get ### Description Gets the value at the specified path `Path` in the object `Obj`. ### Type Parameters - **Path**: The path to retrieve the value from. - **Obj**: The object type to get the value from. ### Usage `Get<'a.b.c', YourObject>` ``` ```APIDOC ## FromEntries ### Description Creates an object from a union of key-value pairs. ### Type Parameters - **Entries**: A union of key-value pairs (e.g., `['key1', 'value1'] | ['key2', 'value2']`). ### Usage `FromEntries<['key', 'value'] | ['anotherKey', 'anotherValue']>` ``` ```APIDOC ## Entries ### Description Extracts the union of key-value pairs from an object type `Obj`. ### Type Parameters - **Obj**: The object type from which to extract entries. ### Usage `Entries` ``` ```APIDOC ## MapValues ### Description Transforms the values of an object type `Obj` using a mapper function `Fn`. ### Type Parameters - **Fn**: The mapper function type. - **Obj**: The object type whose values are to be transformed. ### Usage `MapValues` ``` ```APIDOC ## MapKeys ### Description Transforms the keys of an object type `Obj` using a mapper function `Fn`. ### Type Parameters - **Fn**: The mapper function type. - **Obj**: The object type whose keys are to be transformed. ### Usage `MapKeys` ``` ```APIDOC ## Assign<...Obj> ### Description Merges multiple objects together. ### Type Parameters - **...Obj**: A variadic list of object types to merge. ### Usage `Assign` ``` ```APIDOC ## Pick ### Description Picks specific keys `Key` from an object type `Obj`. ### Type Parameters - **Key**: The key(s) to pick. - **Obj**: The object type from which to pick keys. ### Usage `Pick<'key1' | 'key2', YourObject>` ``` ```APIDOC ## PickBy ### Description Picks keys from an object type `Obj` based on a predicate function `Fn`. ### Type Parameters - **Fn**: The predicate function type. - **Obj**: The object type from which to pick keys. ### Usage `PickBy` ``` ```APIDOC ## Omit ### Description Omits specific keys `Key` from an object type `Obj`. ### Type Parameters - **Key**: The key(s) to omit. - **Obj**: The object type from which to omit keys. ### Usage `Omit<'key1' | 'key2', YourObject>` ``` ```APIDOC ## OmitBy ### Description Omits keys from an object type `Obj` based on a predicate function `Fn`. ### Type Parameters - **Fn**: The predicate function type. - **Obj**: The object type from which to omit keys. ### Usage `OmitBy` ``` ```APIDOC ## CamelCase ### Description Converts the keys of an object type `Obj` to camelCase. ### Type Parameters - **Obj**: The object type whose keys are to be converted. ### Usage `CamelCase` ``` ```APIDOC ## CamelCaseDeep ### Description Recursively converts the keys of an object type `Obj` to camelCase. ### Type Parameters - **Obj**: The object type whose keys are to be recursively converted. ### Usage `CamelCaseDeep` ``` ```APIDOC ## SnakeCase ### Description Converts the keys of an object type `Obj` to snake_case. ### Type Parameters - **Obj**: The object type whose keys are to be converted. ### Usage `SnakeCase` ``` ```APIDOC ## SnakeCaseDeep ### Description Recursively converts the keys of an object type `Obj` to snake_case. ### Type Parameters - **Obj**: The object type whose keys are to be recursively converted. ### Usage `SnakeCaseDeep` ``` ```APIDOC ## KebabCase ### Description Converts the keys of an object type `Obj` to kebab-case. ### Type Parameters - **Obj**: The object type whose keys are to be converted. ### Usage `KebabCase` ``` ```APIDOC ## KebabCaseDeep ### Description Recursively converts the keys of an object type `Obj` to kebab-case. ### Type Parameters - **Obj**: The object type whose keys are to be recursively converted. ### Usage `KebabCaseDeep` ``` -------------------------------- ### String Construction and Manipulation Source: https://context7.com/gvergnaud/hotscript/llms.txt Prepend or append string literals, repeat a string N times, or extract a slice by index range. Ensure 'Strings' and 'Call' are imported from 'hotscript'. ```typescript import { Call, Strings } from "hotscript"; type r0 = Call, "World">; // "Hello, World" ``` ```typescript import { Call, Strings } from "hotscript"; type r1 = Call, "Hello">; // "Hello!" ``` ```typescript import { Call, Strings } from "hotscript"; type r2 = Call, "ab">; // "ababab" ``` ```typescript import { Call, Strings } from "hotscript"; type r3 = Call, "hello">; // "ell" ``` -------------------------------- ### Convert Between Objects and Entry Unions with Objects.FromEntries and Objects.Entries Source: https://context7.com/gvergnaud/hotscript/llms.txt Builds an object from a union of `[key, value]` tuples (`FromEntries`) or extracts such a union from an object (`Entries`). Requires `Call` and `Objects` from 'hotscript'. ```typescript import { Call, Objects } from "hotscript"; type r0 = Call; // ^? { a: 1; b: true } type r1 = Call; // ^? ["a", 1] | ["b", true] ``` -------------------------------- ### Tuple Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Utilities for manipulating and querying tuple types. ```APIDOC ## Create ### Description Creates a unary tuple from a type. ### Usage `Create` returns `[X]` ``` ```APIDOC ## Partition ### Description Using a predicate `Fn`, turns a list of types into two lists: `[Passing[], Rejected[]]`. ### Usage `Partition` ``` ```APIDOC ## IsEmpty ### Description Checks if a tuple is empty. ### Usage `IsEmpty` ``` ```APIDOC ## Zip<...Tuple[]> ### Description Zips several tuples together. For example, it would turn `[[a,b,c], [1,2,3]]` into `[[a, 1], [b, 2], [c, 3]]`. ### Usage `Zip<...Tuple[]>` ``` ```APIDOC ## ZipWith ### Description Zips several tuples by calling a zipper `Fn` with one argument per input tuple. ### Usage `ZipWith` ``` ```APIDOC ## Sort ### Description Sorts a tuple of number literals. ### Usage `Sort` ``` ```APIDOC ## Head ### Description Returns the first element from a tuple type. ### Usage `Head` ``` ```APIDOC ## Tail ### Description Drops the first element from a tuple type. ### Usage `Tail` ``` ```APIDOC ## At ### Description Returns the `N`th element from a tuple. ### Usage `At` ``` ```APIDOC ## Last ### Description Returns the last element from a tuple type. ### Usage `Last` ``` ```APIDOC ## FlatMap ### Description Calls an `Fn` function returning a tuple on each element of the input tuple, and flattens all of the returned tuples into a single one. ### Usage `FlatMap` ``` ```APIDOC ## Find ### Description Finds an element from a tuple using a predicate `Fn`. ### Usage `Find` ``` ```APIDOC ## Drop ### Description Drops the `N` first elements from a tuple. ### Usage `Drop` ``` ```APIDOC ## Take ### Description Takes the `N` first elements from a tuple. ### Usage `Take` ``` ```APIDOC ## TakeWhile ### Description Takes elements while the `Fn` predicate returns `true`. ### Usage `TakeWhile` ``` ```APIDOC ## GroupBy ### Description Transforms a list into an object containing lists. The `Fn` function takes each element and returns the key it should be added to. ### Usage `GroupBy` ``` ```APIDOC ## Join ### Description Joins several strings together using the `Str` separator string. ### Usage `Join` ``` ```APIDOC ## Map ### Description Transforms each element in a tuple. ### Usage `Map` ``` ```APIDOC ## Filter ### Description Removes elements from a tuple if the `Fn` predicate function doesn't return `true`. ### Usage `Filter` ``` ```APIDOC ## Reduce ### Description Iterates over a tuple and reduces it to a single function using a reducer `Fn`. ### Usage `Reduce` ``` ```APIDOC ## ReduceRight ### Description Like `Reduce`, but starting from the end of the list. ### Usage `ReduceRight` ``` ```APIDOC ## Reverse ### Description Reverses the tuple. ### Usage `Reverse` ``` ```APIDOC ## Every ### Description Checks if all elements pass the `Fn` predicate. ### Usage `Every` ``` ```APIDOC ## Some ### Description Checks if at least one element passes the `Fn` predicate. ### Usage `Some` ``` ```APIDOC ## SplitAt ### Description Splits a tuple into a left and a right tuple using an index. ### Usage `SplitAt` ``` ```APIDOC ## ToUnion ### Description Turns a tuple into a union of elements. ### Usage `ToUnion` ``` ```APIDOC ## ToIntersection ### Description Turns a tuple into an intersection of elements. ### Usage `ToIntersection` ``` ```APIDOC ## Prepend ### Description Adds a type at the beginning of a tuple. ### Usage `Prepend` ``` ```APIDOC ## Append ### Description Adds a type at the end of a tuple. ### Usage `Append` ``` ```APIDOC ## Concat ### Description Merges two tuples together. ### Usage `Concat` ``` ```APIDOC ## Min ### Description Returns the minimum number in a list of number literal types. ### Usage `Min` ``` ```APIDOC ## Max ### Description Returns the maximum number in a list of number literal types. ### Usage `Max` ``` ```APIDOC ## Sum ### Description Adds all numbers in a list of number literal types together. ### Usage `Sum` ``` -------------------------------- ### Strings.ToNumber, Strings.ToString, Strings.Length, Strings.ToTuple Source: https://context7.com/gvergnaud/hotscript/llms.txt Convert between string, number, and tuple literal types. ```APIDOC ## Strings.ToNumber, Strings.ToString, Strings.Length, Strings.ToTuple ### Description Convert between string, number, and tuple literal types. ### Usage ```ts import { Call, Strings } from "hotscript"; type r0 = Call; // 42 type r1 = Call; // "42" type r2 = Call; // 5 type r3 = Call; // ["a", "b", "c"] ``` ``` -------------------------------- ### String Utilities Source: https://github.com/gvergnaud/hotscript/blob/main/README.md Utilities for manipulating string literal types, including length, trimming, joining, replacing, slicing, splitting, repeating, case conversion, and comparison. ```APIDOC ## Length ### Description Returns the length of a string type `Str`. ### Type Parameters - **Str**: The string type. ### Usage `Length<'hello'>` ``` ```APIDOC ## TrimLeft ### Description Removes the specified character(s) from the left side of a string type `Str`. ### Type Parameters - **Char**: The character(s) to trim. - **Str**: The string type. ### Usage `TrimLeft<'a', 'aaabc'>` ``` ```APIDOC ## TrimRight ### Description Removes the specified character(s) from the right side of a string type `Str`. ### Type Parameters - **Char**: The character(s) to trim. - **Str**: The string type. ### Usage `TrimRight<'c', 'abccc'>` ``` ```APIDOC ## Trim ### Description Removes the specified character(s) from both sides of a string type `Str`. ### Type Parameters - **Char**: The character(s) to trim. - **Str**: The string type. ### Usage `Trim<'a', 'aabcbaa'>` ``` ```APIDOC ## Join ### Description Joins multiple string types `Str` with a separator `Sep`. ### Type Parameters - **Sep**: The separator string type. - **Str**: A tuple or union of string types to join. ### Usage `Join<'-', ['a', 'b', 'c']>` ``` ```APIDOC ## Replace ### Description Replaces all occurrences of a substring `From` with another substring `To` in a string type `Str`. ### Type Parameters - **From**: The substring to replace. - **To**: The substring to replace with. - **Str**: The string type. ### Usage `Replace<'a', 'b', 'banana'>` ``` ```APIDOC ## Slice ### Description Extracts a portion of a string type `Str` from index `Start` to index `End`. ### Type Parameters - **Start**: The starting index (inclusive). - **End**: The ending index (exclusive). - **Str**: The string type. ### Usage `Slice<1, 4, 'hello'>` ``` ```APIDOC ## Split ### Description Splits a string type `Str` into a tuple of substrings using a separator `Sep`. ### Type Parameters - **Sep**: The separator string type. - **Str**: The string type to split. ### Usage `Split<'-', 'a-b-c'>` ``` ```APIDOC ## Repeat ### Description Repeats a string type `Str` `N` times. ### Type Parameters - **N**: The number of times to repeat. - **Str**: The string type. ### Usage `Repeat<3, 'a'>` ``` ```APIDOC ## StartsWith ### Description Checks if a string type `Str` starts with a substring `S`. ### Type Parameters - **S**: The substring to check for. - **Str**: The string type. ### Usage `StartsWith<'he', 'hello'>` ``` ```APIDOC ## EndsWith ### Description Checks if a string type `Str` ends with a substring `E`. ### Type Parameters - **E**: The substring to check for. - **Str**: The string type. ### Usage `EndsWith<'lo', 'hello'>` ``` ```APIDOC ## ToTuple ### Description Converts a string type `Str` to a tuple type where each element is a character. ### Type Parameters - **Str**: The string type. ### Usage `ToTuple<'abc'>` ``` ```APIDOC ## ToNumber ### Description Converts a string type `Str` to a number literal type. ### Type Parameters - **Str**: The string type. ### Usage `ToNumber<'123'>` ``` ```APIDOC ## ToString ### Description Converts any literal type `T` to a string literal type. ### Type Parameters - **T**: The literal type. ### Usage `ToString<123>` ``` ```APIDOC ## Prepend ### Description Prepends a string type `Start` to the beginning of a string type `Str`. ### Type Parameters - **Start**: The string to prepend. - **Str**: The target string. ### Usage `Prepend<'pre', 'fix'>` ``` ```APIDOC ## Append ### Description Appends a string type `End` to the end of a string type `Str`. ### Type Parameters - **End**: The string to append. - **Str**: The target string. ### Usage `Append<'fix', 'pre'>` ``` ```APIDOC ## Uppercase ### Description Converts a string type `Str` to uppercase. ### Type Parameters - **Str**: The string type. ### Usage `Uppercase<'hello'>` ``` ```APIDOC ## Lowercase ### Description Converts a string type `Str` to lowercase. ### Type Parameters - **Str**: The string type. ### Usage `Lowercase<'HELLO'>` ``` ```APIDOC ## Capitalize ### Description Capitalizes the first letter of a string type `Str`. ### Type Parameters - **Str**: The string type. ### Usage `Capitalize<'hello'>` ``` ```APIDOC ## Uncapitalize ### Description Converts the first letter of a string type `Str` to lowercase. ### Type Parameters - **Str**: The string type. ### Usage `Uncapitalize<'Hello'>` ``` ```APIDOC ## SnakeCase ### Description Converts a string type `Str` to snake_case. ### Type Parameters - **Str**: The string type. ### Usage `SnakeCase<'helloWorld'>` ``` ```APIDOC ## CamelCase ### Description Converts a string type `Str` to camelCase. ### Type Parameters - **Str**: The string type. ### Usage `CamelCase<'hello_world'>` ``` ```APIDOC ## KebabCase ### Description Converts a string type `Str` to kebab-case. ### Type Parameters - **Str**: The string type. ### Usage `KebabCase<'hello_world'>` ``` ```APIDOC ## Compare ### Description Compares two string types `Str1` and `Str2` and returns a number indicating their relative order (-1 if Str1 < Str2, 0 if Str1 == Str2, 1 if Str1 > Str2). ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `Compare<'a', 'b'>` ``` ```APIDOC ## Equal ### Description Checks if two string types `Str1` and `Str2` are equal. ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `Equal<'hello', 'hello'>` ``` ```APIDOC ## NotEqual ### Description Checks if two string types `Str1` and `Str2` are not equal. ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `NotEqual<'hello', 'world'>` ``` ```APIDOC ## LessThan ### Description Checks if `Str1` is less than `Str2` in lexicographical order. ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `LessThan<'a', 'b'>` ``` ```APIDOC ## LessThanOrEqual ### Description Checks if `Str1` is less than or equal to `Str2` in lexicographical order. ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `LessThanOrEqual<'a', 'a'>` ``` ```APIDOC ## GreaterThan ### Description Checks if `Str1` is greater than `Str2` in lexicographical order. ### Type Parameters - **Str1**: The first string type. - **Str2**: The second string type. ### Usage `GreaterThan<'b', 'a'>` ```