@eslint-react/eff
Advanced tools
Comparing version 1.23.3-next.8 to 1.24.0-next.0
@@ -1,5 +0,281 @@ | ||
import * as Function from 'effect/Function'; | ||
export { Function as F }; | ||
import * as Option from 'effect/Option'; | ||
export { Option as O }; | ||
export * from 'effect/Predicate'; | ||
type Pretty<T> = { | ||
[P in keyof T]: T[P]; | ||
} & {}; | ||
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false; | ||
/** | ||
* An extension of Extract for type predicates which falls back to the base | ||
* in order to narrow the `unknown` case. | ||
* | ||
* @example | ||
* function isMyType<T>(data: T | MyType): data is NarrowedTo<T, MyType> { ... } | ||
*/ | ||
type NarrowedTo<T, Base> = Extract<T, Base> extends never ? Base : IsAny<T> extends true ? Base : Extract<T, Base>; | ||
type Reverse<T extends Record<any, any>> = { | ||
[U in keyof T as T[U]]: U; | ||
}; | ||
declare function birecord<const T extends Record<any, any>>(original: T): BiRecord<T>; | ||
declare class BiRecord<const T extends Record<any, any>> { | ||
original: T; | ||
reversed: Reverse<T>; | ||
constructor(original: T, reversed?: Reverse<T>); | ||
get<U extends keyof T | T[keyof T]>(key: U): U extends keyof T ? T[U] : U extends T[keyof T] ? Reverse<T>[U] : unknown; | ||
has(key: any): key is keyof T | T[keyof T]; | ||
} | ||
type EntriesEntryForKey<T, Key extends keyof T> = Key extends number | string ? [key: `${Key}`, value: Required<T>[Key]] : never; | ||
type EntriesEntry<T> = Pretty<{ | ||
[P in keyof T]-?: EntriesEntryForKey<T, P>; | ||
}[keyof T]>; | ||
declare function entries<T extends {}>(data: T): Array<EntriesEntry<T>>; | ||
declare function entries(): <T extends {}>(data: T) => Array<EntriesEntry<T>>; | ||
type IterableContainer<T = unknown> = readonly [] | ReadonlyArray<T>; | ||
type FromEntriesEntry<Key extends PropertyKey = PropertyKey, Value = unknown> = readonly [ | ||
key: Key, | ||
value: Value | ||
]; | ||
type FromEntries<Entries> = Entries extends readonly [ | ||
infer First, | ||
...infer Tail | ||
] ? FromEntriesTuple<First, Tail> : Entries extends readonly [...infer Head, infer Last] ? FromEntriesTuple<Last, Head> : Entries extends IterableContainer<FromEntriesEntry> ? FromEntriesArray<Entries> : "ERROR: Entries array-like could not be inferred"; | ||
type FromEntriesTuple<E, Rest> = E extends FromEntriesEntry ? FromEntries<Rest> & Record<E[0], E[1]> : "ERROR: Array-like contains a non-entry element"; | ||
type FromEntriesArray<Entries extends IterableContainer<FromEntriesEntry>> = string extends AllKeys<Entries> ? Record<string, Entries[number][1]> : number extends AllKeys<Entries> ? Record<number, Entries[number][1]> : symbol extends AllKeys<Entries> ? Record<symbol, Entries[number][1]> : FromEntriesArrayWithLiteralKeys<Entries>; | ||
type FromEntriesArrayWithLiteralKeys<Entries extends IterableContainer<FromEntriesEntry>> = { | ||
[P in AllKeys<Entries>]?: ValueForKey<Entries, P>; | ||
}; | ||
type AllKeys<Entries extends IterableContainer<FromEntriesEntry>> = Extract<Entries[number], FromEntriesEntry>[0]; | ||
type ValueForKey<Entries extends IterableContainer<FromEntriesEntry>, K extends PropertyKey> = (Extract<Entries[number], FromEntriesEntry<K>> extends never ? Entries[number] : Extract<Entries[number], FromEntriesEntry<K>>)[1]; | ||
declare function fromEntries<Entries extends IterableContainer<FromEntriesEntry>>(entries: Entries): Pretty<FromEntries<Entries>>; | ||
declare function fromEntries(): <Entries extends IterableContainer<FromEntriesEntry>>(entries: Entries) => Pretty<FromEntries<Entries>>; | ||
/** | ||
* Creates a function that can be used in a data-last (aka `pipe`able) or | ||
* data-first style. | ||
* | ||
* The first parameter to `dual` is either the arity of the uncurried function | ||
* or a predicate that determines if the function is being used in a data-first | ||
* or data-last style. | ||
* | ||
* Using the arity is the most common use case, but there are some cases where | ||
* you may want to use a predicate. For example, if you have a function that | ||
* takes an optional argument, you can use a predicate to determine if the | ||
* function is being used in a data-first or data-last style. | ||
* | ||
* @param arity - Either the arity of the uncurried function or a predicate | ||
* which determines if the function is being used in a data-first | ||
* or data-last style. | ||
* @param body - The definition of the uncurried function. | ||
* | ||
* @example | ||
* ```ts | ||
* import { dual, pipe } from "effect/Function" | ||
* | ||
* // Exampe using arity to determine data-first or data-last style | ||
* const sum: { | ||
* (that: number): (self: number) => number | ||
* (self: number, that: number): number | ||
* } = dual(2, (self: number, that: number): number => self + that) | ||
* | ||
* assert.deepStrictEqual(sum(2, 3), 5) | ||
* assert.deepStrictEqual(pipe(2, sum(3)), 5) | ||
* | ||
* // Example using a predicate to determine data-first or data-last style | ||
* const sum2: { | ||
* (that: number): (self: number) => number | ||
* (self: number, that: number): number | ||
* } = dual((args) => args.length === 1, (self: number, that: number): number => self + that) | ||
* | ||
* assert.deepStrictEqual(sum(2, 3), 5) | ||
* assert.deepStrictEqual(pipe(2, sum(3)), 5) | ||
* ``` | ||
*/ | ||
declare const dual: { | ||
<DataLast extends (...args: Array<any>) => any, DataFirst extends (...args: Array<any>) => any>(arity: Parameters<DataFirst>["length"], body: DataFirst): DataLast & DataFirst; | ||
<DataLast extends (...args: Array<any>) => any, DataFirst extends (...args: Array<any>) => any>(isDataFirst: (args: IArguments) => boolean, body: DataFirst): DataLast & DataFirst; | ||
}; | ||
/** | ||
* Reverses the order of arguments for a curried function. | ||
* | ||
* @param f - A curried function that takes multiple arguments. | ||
* | ||
* @example | ||
* ```ts | ||
* import { flip } from "effect/Function" | ||
* | ||
* const f = (a: number) => (b: string) => a - b.length | ||
* | ||
* assert.deepStrictEqual(flip(f)('aaa')(2), -1) | ||
* ``` | ||
*/ | ||
declare const flip: <A extends Array<unknown>, B extends Array<unknown>, C>(f: (...a: A) => (...b: B) => C) => (...b: B) => (...a: A) => C; | ||
/** | ||
* Pipes the value of an expression into a pipeline of functions. | ||
* | ||
* **When to Use** | ||
* | ||
* This is useful in combination with data-last functions as a simulation of | ||
* methods: | ||
* | ||
* ```ts | ||
* as.map(f).filter(g) | ||
* ``` | ||
* | ||
* becomes: | ||
* | ||
* ```ts | ||
* import { pipe, Array } from "eff" | ||
* | ||
* pipe(as, Array.map(f), Array.filter(g)) | ||
* ``` | ||
* | ||
* **Details** | ||
* | ||
* The `pipe` function is a utility that allows us to compose functions in a | ||
* readable and sequential manner. It takes the output of one function and | ||
* passes it as the input to the next function in the pipeline. This enables us | ||
* to build complex transformations by chaining multiple functions together. | ||
* | ||
* ```ts | ||
* import { pipe } from "eff" | ||
* | ||
* const result = pipe(input, func1, func2, ..., funcN) | ||
* ``` | ||
* | ||
* In this syntax, `input` is the initial value, and `func1`, `func2`, ..., | ||
* `funcN` are the functions to be applied in sequence. The result of each | ||
* function becomes the input for the next function, and the final result is | ||
* returned. | ||
* | ||
* Here's an illustration of how `pipe` works: | ||
* | ||
* ```text | ||
* ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌────────┐ | ||
* │ input │───►│ func1 │───►│ func2 │───►│ ... │───►│ funcN │───►│ result │ | ||
* └───────┘ └───────┘ └───────┘ └───────┘ └───────┘ └────────┘ | ||
* ``` | ||
* | ||
* It's important to note that functions passed to `pipe` must have a **single | ||
* argument** because they are only called with a single argument. | ||
* | ||
* @example | ||
* ```ts | ||
* // Example: Chaining Arithmetic Operations | ||
* import { pipe } from "eff" | ||
* | ||
* // Define simple arithmetic operations | ||
* const increment = (x: number) => x + 1 | ||
* const double = (x: number) => x * 2 | ||
* const subtractTen = (x: number) => x - 10 | ||
* | ||
* // Sequentially apply these operations using `pipe` | ||
* const result = pipe(5, increment, double, subtractTen) | ||
* | ||
* console.log(result) | ||
* // Output: 2 | ||
* ``` | ||
*/ | ||
declare function pipe<A>(a: A): A; | ||
declare function pipe<A, B = never>(a: A, ab: (a: A) => B): B; | ||
declare function pipe<A, B = never, C = never>(a: A, ab: (a: A) => B, bc: (b: B) => C): C; | ||
declare function pipe<A, B = never, C = never, D = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D; | ||
declare function pipe<A, B = never, C = never, D = never, E = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): F; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G): G; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H): H; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): K; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): L; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): M; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): N; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): O; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): P; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): Q; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): R; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): S; | ||
declare function pipe<A, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R = never, S = never, T = never>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): T; | ||
/** | ||
* Performs left-to-right function composition. The first argument may have any arity, the remaining arguments must be unary. | ||
* | ||
* See also [`pipe`](#pipe). | ||
* | ||
* @example | ||
* ```ts | ||
* import { flow } from "effect/Function" | ||
* | ||
* const len = (s: string): number => s.length | ||
* const double = (n: number): number => n * 2 | ||
* | ||
* const f = flow(len, double) | ||
* | ||
* assert.strictEqual(f('aaa'), 6) | ||
* ``` | ||
*/ | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never>(ab: (...a: A) => B): (...a: A) => B; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never>(ab: (...a: A) => B, bc: (b: B) => C): (...a: A) => C; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...a: A) => D; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): (...a: A) => E; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): (...a: A) => F; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never, G = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G): (...a: A) => G; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never, G = never, H = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H): (...a: A) => H; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): (...a: A) => I; | ||
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...a: A) => J; | ||
/** | ||
* 1-byte version undefined, produces fewer bytes than `undefined` or `void 0` in the minified output d.ts. | ||
*/ | ||
type _ = undefined; | ||
/** | ||
* 1-byte version undefined, produces fewer bytes than `undefined` or `void 0` in the minified output js. | ||
*/ | ||
declare const _: undefined; | ||
/** | ||
* Do nothing and return false | ||
*/ | ||
declare function returnFalse(): false; | ||
/** | ||
* Do nothing and return true | ||
*/ | ||
declare function returnTrue(): true; | ||
/** | ||
* Do nothing and return undefined | ||
*/ | ||
declare function returnVoid(): _; | ||
/** | ||
* Returns its argument. | ||
*/ | ||
declare function identity<T>(x: T): T; | ||
/** | ||
* A function that takes a guard function as predicate and returns a guard that negates it. | ||
* | ||
* @param predicate - The guard function to negate. | ||
* @returns Function A guard function. | ||
*/ | ||
declare function not<T, S extends T>(predicate: (data: T) => data is S): (data: T) => data is Exclude<T, S>; | ||
declare function not<T>(predicate: (data: T) => boolean): (data: T) => boolean; | ||
declare function or<T, S extends T, U extends T>(a: (data: T) => data is S, b: (data: T) => data is U): (data: T) => data is S | U; | ||
declare function or<T, S extends T>(a: (data: T) => data is S, b: (data: T) => boolean): (data: T) => data is S; | ||
declare function or<T, U extends T>(a: (data: T) => boolean, b: (data: T) => data is U): (data: T) => data is U; | ||
declare function or<T>(a: (data: T) => boolean, b: (data: T) => boolean): (data: T) => boolean; | ||
/** | ||
* A function that checks if the passed parameter is an Array and narrows its type accordingly. | ||
* | ||
* @param data - The variable to check. | ||
* @returns True if the passed input is an Array, false otherwise. s | ||
*/ | ||
declare function isArray<T>(data: ArrayLike<unknown> | T): data is NarrowedTo<T, ReadonlyArray<unknown>>; | ||
/** | ||
* Checks if the given parameter is of type `"object"` via `typeof`, excluding `null`. | ||
* | ||
* @param data - The variable to be checked for being an object type. | ||
* @returns The input type, narrowed to only objects. | ||
*/ | ||
declare function isObject<T>(data: T | object): data is NarrowedTo<T, object>; | ||
/** | ||
* A function that checks if the passed parameter is truthy and narrows its type accordingly. | ||
* | ||
* @param data - The variable to check. | ||
* @returns True if the passed input is truthy, false otherwise. | ||
*/ | ||
declare function isTruthy<T>(data: T): data is Exclude<T, "" | 0 | false | null | undefined>; | ||
export { BiRecord, type NarrowedTo, type Pretty, _, birecord, dual, entries, flip, flow, fromEntries, identity, isArray, isObject, isTruthy, not, or, pipe, returnFalse, returnTrue, returnVoid }; |
1023
dist/index.js
'use strict'; | ||
var __defProp = Object.defineProperty; | ||
var __export = (target, all3) => { | ||
for (var name in all3) | ||
__defProp(target, name, { get: all3[name], enumerable: true }); | ||
// src/collection.ts | ||
function reverse(record) { | ||
return Object.fromEntries( | ||
Object.entries(record).map(([key, value]) => [value, key]) | ||
); | ||
} | ||
function birecord(original) { | ||
return new BiRecord(original); | ||
} | ||
var BiRecord = class { | ||
constructor(original, reversed = reverse(original)) { | ||
this.original = original; | ||
this.reversed = reversed; | ||
} | ||
get(key) { | ||
return this.original[key] ?? this.reversed[key]; | ||
} | ||
has(key) { | ||
return key in this.original || key in this.reversed; | ||
} | ||
}; | ||
function entries(...args) { | ||
return Object.entries(args); | ||
} | ||
function fromEntries(...args) { | ||
return Object.fromEntries(args); | ||
} | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Function.js | ||
var Function_exports = {}; | ||
__export(Function_exports, { | ||
SK: () => SK, | ||
absurd: () => absurd, | ||
apply: () => apply, | ||
compose: () => compose, | ||
constFalse: () => constFalse, | ||
constNull: () => constNull, | ||
constTrue: () => constTrue, | ||
constUndefined: () => constUndefined, | ||
constVoid: () => constVoid, | ||
constant: () => constant, | ||
dual: () => dual, | ||
flip: () => flip, | ||
flow: () => flow, | ||
hole: () => hole, | ||
identity: () => identity, | ||
isFunction: () => isFunction, | ||
pipe: () => pipe, | ||
satisfies: () => satisfies, | ||
tupled: () => tupled, | ||
unsafeCoerce: () => unsafeCoerce, | ||
untupled: () => untupled | ||
}); | ||
var isFunction = (input) => typeof input === "function"; | ||
// src/function.ts | ||
var dual = function(arity, body) { | ||
@@ -96,19 +93,3 @@ if (typeof arity === "function") { | ||
}; | ||
var apply = (a) => (self) => self(a); | ||
var identity = (a) => a; | ||
var satisfies = () => (b) => b; | ||
var unsafeCoerce = identity; | ||
var constant = (value) => () => value; | ||
var constTrue = /* @__PURE__ */ constant(true); | ||
var constFalse = /* @__PURE__ */ constant(false); | ||
var constNull = /* @__PURE__ */ constant(null); | ||
var constUndefined = /* @__PURE__ */ constant(undefined); | ||
var constVoid = constUndefined; | ||
var flip = (f) => (...b) => (...a) => f(...a)(...b); | ||
var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => bc(ab(a))); | ||
var absurd = (_) => { | ||
throw new Error("Called `absurd` function which should be uncallable"); | ||
}; | ||
var tupled = (f) => (a) => f(...a); | ||
var untupled = (f) => (...a) => f(a); | ||
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) { | ||
@@ -182,922 +163,50 @@ switch (arguments.length) { | ||
} | ||
var hole = /* @__PURE__ */ unsafeCoerce(absurd); | ||
var SK = (_, b) => b; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Option.js | ||
var Option_exports = {}; | ||
__export(Option_exports, { | ||
Do: () => Do, | ||
TypeId: () => TypeId3, | ||
all: () => all2, | ||
andThen: () => andThen, | ||
ap: () => ap, | ||
as: () => as, | ||
asVoid: () => asVoid, | ||
bind: () => bind2, | ||
bindTo: () => bindTo2, | ||
composeK: () => composeK, | ||
contains: () => contains, | ||
containsWith: () => containsWith, | ||
exists: () => exists, | ||
filter: () => filter, | ||
filterMap: () => filterMap, | ||
firstSomeOf: () => firstSomeOf, | ||
flatMap: () => flatMap, | ||
flatMapNullable: () => flatMapNullable, | ||
flatten: () => flatten, | ||
fromIterable: () => fromIterable, | ||
fromNullable: () => fromNullable, | ||
gen: () => gen, | ||
getEquivalence: () => getEquivalence, | ||
getLeft: () => getLeft2, | ||
getOrElse: () => getOrElse, | ||
getOrNull: () => getOrNull, | ||
getOrThrow: () => getOrThrow, | ||
getOrThrowWith: () => getOrThrowWith, | ||
getOrUndefined: () => getOrUndefined, | ||
getOrder: () => getOrder, | ||
getRight: () => getRight2, | ||
isNone: () => isNone2, | ||
isOption: () => isOption2, | ||
isSome: () => isSome2, | ||
let: () => let_2, | ||
lift2: () => lift2, | ||
liftNullable: () => liftNullable, | ||
liftPredicate: () => liftPredicate, | ||
liftThrowable: () => liftThrowable, | ||
map: () => map, | ||
match: () => match, | ||
none: () => none2, | ||
orElse: () => orElse, | ||
orElseEither: () => orElseEither, | ||
orElseSome: () => orElseSome, | ||
partitionMap: () => partitionMap, | ||
product: () => product2, | ||
productMany: () => productMany2, | ||
reduceCompact: () => reduceCompact, | ||
some: () => some3, | ||
tap: () => tap, | ||
toArray: () => toArray, | ||
toRefinement: () => toRefinement, | ||
void: () => void_, | ||
zipLeft: () => zipLeft, | ||
zipRight: () => zipRight, | ||
zipWith: () => zipWith | ||
}); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/version.js | ||
var moduleVersion = "3.12.1"; | ||
var getCurrentVersion = () => moduleVersion; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/GlobalValue.js | ||
var globalStoreId = `effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`; | ||
var globalStore; | ||
var globalValue = (id, compute) => { | ||
if (!globalStore) { | ||
globalThis[globalStoreId] ??= /* @__PURE__ */ new Map(); | ||
globalStore = globalThis[globalStoreId]; | ||
} | ||
if (!globalStore.has(id)) { | ||
globalStore.set(id, compute()); | ||
} | ||
return globalStore.get(id); | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Predicate.js | ||
var mapInput = /* @__PURE__ */ dual(2, (self, f) => (b) => self(f(b))); | ||
var isTupleOf = /* @__PURE__ */ dual(2, (self, n) => self.length === n); | ||
var isTupleOfAtLeast = /* @__PURE__ */ dual(2, (self, n) => self.length >= n); | ||
var isTruthy = (input) => !!input; | ||
var isSet = (input) => input instanceof Set; | ||
var isMap = (input) => input instanceof Map; | ||
var isString = (input) => typeof input === "string"; | ||
var isNumber = (input) => typeof input === "number"; | ||
var isBoolean = (input) => typeof input === "boolean"; | ||
var isBigInt = (input) => typeof input === "bigint"; | ||
var isSymbol = (input) => typeof input === "symbol"; | ||
var isFunction2 = isFunction; | ||
var isUndefined = (input) => input === undefined; | ||
var isNotUndefined = (input) => input !== undefined; | ||
var isNull = (input) => input === null; | ||
var isNotNull = (input) => input !== null; | ||
var isNever = (_) => false; | ||
var isUnknown = (_) => true; | ||
var isRecordOrArray = (input) => typeof input === "object" && input !== null; | ||
var isObject = (input) => isRecordOrArray(input) || isFunction2(input); | ||
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self); | ||
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag); | ||
var isNullable = (input) => input === null || input === undefined; | ||
var isNotNullable = (input) => input !== null && input !== undefined; | ||
var isError = (input) => input instanceof Error; | ||
var isUint8Array = (input) => input instanceof Uint8Array; | ||
var isDate = (input) => input instanceof Date; | ||
var isIterable = (input) => hasProperty(input, Symbol.iterator); | ||
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input); | ||
var isReadonlyRecord = isRecord; | ||
var isPromise = (input) => hasProperty(input, "then") && "catch" in input && isFunction2(input.then) && isFunction2(input.catch); | ||
var isPromiseLike = (input) => hasProperty(input, "then") && isFunction2(input.then); | ||
var isRegExp = (input) => input instanceof RegExp; | ||
var compose2 = /* @__PURE__ */ dual(2, (ab, bc) => (a) => ab(a) && bc(a)); | ||
var product = (self, that) => ([a, b]) => self(a) && that(b); | ||
var all = (collection) => { | ||
return (as2) => { | ||
let collectionIndex = 0; | ||
for (const p of collection) { | ||
if (collectionIndex >= as2.length) { | ||
break; | ||
} | ||
if (p(as2[collectionIndex]) === false) { | ||
return false; | ||
} | ||
collectionIndex++; | ||
} | ||
return true; | ||
}; | ||
}; | ||
var productMany = (self, collection) => { | ||
const rest = all(collection); | ||
return ([head, ...tail]) => self(head) === false ? false : rest(tail); | ||
}; | ||
var tuple = (...elements) => all(elements); | ||
var struct = (fields) => { | ||
const keys = Object.keys(fields); | ||
return (a) => { | ||
for (const key of keys) { | ||
if (!fields[key](a[key])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
}; | ||
var not = (self) => (a) => !self(a); | ||
var or = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) || that(a)); | ||
var and = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) && that(a)); | ||
var xor = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) !== that(a)); | ||
var eqv = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) === that(a)); | ||
var implies = /* @__PURE__ */ dual(2, (antecedent, consequent) => (a) => antecedent(a) ? consequent(a) : true); | ||
var nor = /* @__PURE__ */ dual(2, (self, that) => (a) => !(self(a) || that(a))); | ||
var nand = /* @__PURE__ */ dual(2, (self, that) => (a) => !(self(a) && that(a))); | ||
var every = (collection) => (a) => { | ||
for (const p of collection) { | ||
if (!p(a)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
var some = (collection) => (a) => { | ||
for (const p of collection) { | ||
if (p(a)) { | ||
return true; | ||
} | ||
} | ||
// src/lang.ts | ||
var _ = undefined; | ||
function returnFalse() { | ||
return false; | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/errors.js | ||
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Utils.js | ||
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind"); | ||
var isGenKind = (u) => isObject(u) && GenKindTypeId in u; | ||
var GenKindImpl = class { | ||
value; | ||
constructor(value) { | ||
this.value = value; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
get _F() { | ||
return identity; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
get _R() { | ||
return (_) => _; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
get _O() { | ||
return (_) => _; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
get _E() { | ||
return (_) => _; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
[GenKindTypeId] = GenKindTypeId; | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
[Symbol.iterator]() { | ||
return new SingleShotGen(this); | ||
} | ||
}; | ||
var SingleShotGen = class _SingleShotGen { | ||
self; | ||
called = false; | ||
constructor(self) { | ||
this.self = self; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
next(a) { | ||
return this.called ? { | ||
value: a, | ||
done: true | ||
} : (this.called = true, { | ||
value: this.self, | ||
done: false | ||
}); | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
return(a) { | ||
return { | ||
value: a, | ||
done: true | ||
}; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
throw(e) { | ||
throw e; | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
[Symbol.iterator]() { | ||
return new _SingleShotGen(this.self); | ||
} | ||
}; | ||
var adapter = () => function() { | ||
let x = arguments[0]; | ||
for (let i = 1; i < arguments.length; i++) { | ||
x = arguments[i](x); | ||
} | ||
return new GenKindImpl(x); | ||
}; | ||
var YieldWrapTypeId = /* @__PURE__ */ Symbol.for("effect/Utils/YieldWrap"); | ||
var YieldWrap = class { | ||
/** | ||
* @since 3.0.6 | ||
*/ | ||
#value; | ||
constructor(value) { | ||
this.#value = value; | ||
} | ||
/** | ||
* @since 3.0.6 | ||
*/ | ||
[YieldWrapTypeId]() { | ||
return this.#value; | ||
} | ||
}; | ||
function yieldWrapGet(self) { | ||
if (typeof self === "object" && self !== null && YieldWrapTypeId in self) { | ||
return self[YieldWrapTypeId](); | ||
} | ||
throw new Error(getBugErrorMessage("yieldWrapGet")); | ||
} | ||
var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({ | ||
enabled: false, | ||
tester: undefined | ||
})); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Hash.js | ||
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap()); | ||
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash"); | ||
var hash = (self) => { | ||
if (structuralRegionState.enabled === true) { | ||
return 0; | ||
} | ||
switch (typeof self) { | ||
case "number": | ||
return number(self); | ||
case "bigint": | ||
return string(self.toString(10)); | ||
case "boolean": | ||
return string(String(self)); | ||
case "symbol": | ||
return string(String(self)); | ||
case "string": | ||
return string(self); | ||
case "undefined": | ||
return string("undefined"); | ||
case "function": | ||
case "object": { | ||
if (self === null) { | ||
return string("null"); | ||
} else if (self instanceof Date) { | ||
return hash(self.toISOString()); | ||
} else if (isHash(self)) { | ||
return self[symbol](); | ||
} else { | ||
return random(self); | ||
} | ||
} | ||
default: | ||
throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`); | ||
} | ||
}; | ||
var random = (self) => { | ||
if (!randomHashCache.has(self)) { | ||
randomHashCache.set(self, number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))); | ||
} | ||
return randomHashCache.get(self); | ||
}; | ||
var combine = (b) => (self) => self * 53 ^ b; | ||
var optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824; | ||
var isHash = (u) => hasProperty(u, symbol); | ||
var number = (n) => { | ||
if (n !== n || n === Infinity) { | ||
return 0; | ||
} | ||
let h = n | 0; | ||
if (h !== n) { | ||
h ^= n * 4294967295; | ||
} | ||
while (n > 4294967295) { | ||
h ^= n /= 4294967295; | ||
} | ||
return optimize(h); | ||
}; | ||
var string = (str) => { | ||
let h = 5381, i = str.length; | ||
while (i) { | ||
h = h * 33 ^ str.charCodeAt(--i); | ||
} | ||
return optimize(h); | ||
}; | ||
var cached = function() { | ||
if (arguments.length === 1) { | ||
const self2 = arguments[0]; | ||
return function(hash3) { | ||
Object.defineProperty(self2, symbol, { | ||
value() { | ||
return hash3; | ||
}, | ||
enumerable: false | ||
}); | ||
return hash3; | ||
}; | ||
} | ||
const self = arguments[0]; | ||
const hash2 = arguments[1]; | ||
Object.defineProperty(self, symbol, { | ||
value() { | ||
return hash2; | ||
}, | ||
enumerable: false | ||
}); | ||
return hash2; | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Equal.js | ||
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal"); | ||
function equals() { | ||
if (arguments.length === 1) { | ||
return (self) => compareBoth(self, arguments[0]); | ||
} | ||
return compareBoth(arguments[0], arguments[1]); | ||
function returnTrue() { | ||
return true; | ||
} | ||
function compareBoth(self, that) { | ||
if (self === that) { | ||
return true; | ||
} | ||
const selfType = typeof self; | ||
if (selfType !== typeof that) { | ||
return false; | ||
} | ||
if (selfType === "object" || selfType === "function") { | ||
if (self !== null && that !== null) { | ||
if (isEqual(self) && isEqual(that)) { | ||
if (hash(self) === hash(that) && self[symbol2](that)) { | ||
return true; | ||
} else { | ||
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false; | ||
} | ||
} else if (self instanceof Date && that instanceof Date) { | ||
return self.toISOString() === that.toISOString(); | ||
} | ||
} | ||
if (structuralRegionState.enabled) { | ||
if (Array.isArray(self) && Array.isArray(that)) { | ||
return self.length === that.length && self.every((v, i) => compareBoth(v, that[i])); | ||
} | ||
if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) { | ||
const keysSelf = Object.keys(self); | ||
const keysThat = Object.keys(that); | ||
if (keysSelf.length === keysThat.length) { | ||
for (const key of keysSelf) { | ||
if (!(key in that && compareBoth(self[key], that[key]))) { | ||
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false; | ||
} | ||
} | ||
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false; | ||
function returnVoid() { | ||
return _; | ||
} | ||
var isEqual = (u) => hasProperty(u, symbol2); | ||
var equivalence = () => equals; | ||
function identity(x) { | ||
return x; | ||
} | ||
function not(predicate) { | ||
return (data) => !predicate(data); | ||
} | ||
function or(a, b) { | ||
return (data) => a(data) || b(data); | ||
} | ||
function isArray(data) { | ||
return Array.isArray(data); | ||
} | ||
function isObject(data) { | ||
return typeof data === "object" && data !== null; | ||
} | ||
function isTruthy(data) { | ||
return Boolean(data); | ||
} | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Equivalence.js | ||
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/doNotation.js | ||
var let_ = (map2) => dual(3, (self, name, f) => map2(self, (a) => Object.assign({}, a, { | ||
[name]: f(a) | ||
}))); | ||
var bindTo = (map2) => dual(2, (self, name) => map2(self, (a) => ({ | ||
[name]: a | ||
}))); | ||
var bind = (map2, flatMap2) => dual(3, (self, name, f) => flatMap2(self, (a) => map2(f(a), (b) => Object.assign({}, a, { | ||
[name]: b | ||
})))); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Inspectable.js | ||
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"); | ||
var toJSON = (x) => { | ||
try { | ||
if (hasProperty(x, "toJSON") && isFunction2(x["toJSON"]) && x["toJSON"].length === 0) { | ||
return x.toJSON(); | ||
} else if (Array.isArray(x)) { | ||
return x.map(toJSON); | ||
} | ||
} catch (_) { | ||
return {}; | ||
} | ||
return redact(x); | ||
}; | ||
var format = (x) => JSON.stringify(x, null, 2); | ||
var symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable"); | ||
var isRedactable = (u) => typeof u === "object" && u !== null && symbolRedactable in u; | ||
var redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({ | ||
fiberRefs: undefined | ||
})); | ||
var redact = (u) => { | ||
if (isRedactable(u) && redactableState.fiberRefs !== undefined) { | ||
return u[symbolRedactable](redactableState.fiberRefs); | ||
} | ||
return u; | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Pipeable.js | ||
var pipeArguments = (self, args) => { | ||
switch (args.length) { | ||
case 0: | ||
return self; | ||
case 1: | ||
return args[0](self); | ||
case 2: | ||
return args[1](args[0](self)); | ||
case 3: | ||
return args[2](args[1](args[0](self))); | ||
case 4: | ||
return args[3](args[2](args[1](args[0](self)))); | ||
case 5: | ||
return args[4](args[3](args[2](args[1](args[0](self))))); | ||
case 6: | ||
return args[5](args[4](args[3](args[2](args[1](args[0](self)))))); | ||
case 7: | ||
return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))); | ||
case 8: | ||
return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))); | ||
case 9: | ||
return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))))); | ||
default: { | ||
let ret = self; | ||
for (let i = 0, len = args.length; i < len; i++) { | ||
ret = args[i](ret); | ||
} | ||
return ret; | ||
} | ||
} | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/effectable.js | ||
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect"); | ||
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream"); | ||
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink"); | ||
var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel"); | ||
var effectVariance = { | ||
/* c8 ignore next */ | ||
_R: (_) => _, | ||
/* c8 ignore next */ | ||
_E: (_) => _, | ||
/* c8 ignore next */ | ||
_A: (_) => _, | ||
_V: /* @__PURE__ */ getCurrentVersion() | ||
}; | ||
var sinkVariance = { | ||
/* c8 ignore next */ | ||
_A: (_) => _, | ||
/* c8 ignore next */ | ||
_In: (_) => _, | ||
/* c8 ignore next */ | ||
_L: (_) => _, | ||
/* c8 ignore next */ | ||
_E: (_) => _, | ||
/* c8 ignore next */ | ||
_R: (_) => _ | ||
}; | ||
var channelVariance = { | ||
/* c8 ignore next */ | ||
_Env: (_) => _, | ||
/* c8 ignore next */ | ||
_InErr: (_) => _, | ||
/* c8 ignore next */ | ||
_InElem: (_) => _, | ||
/* c8 ignore next */ | ||
_InDone: (_) => _, | ||
/* c8 ignore next */ | ||
_OutErr: (_) => _, | ||
/* c8 ignore next */ | ||
_OutElem: (_) => _, | ||
/* c8 ignore next */ | ||
_OutDone: (_) => _ | ||
}; | ||
var EffectPrototype = { | ||
[EffectTypeId]: effectVariance, | ||
[StreamTypeId]: effectVariance, | ||
[SinkTypeId]: sinkVariance, | ||
[ChannelTypeId]: channelVariance, | ||
[symbol2](that) { | ||
return this === that; | ||
}, | ||
[symbol]() { | ||
return cached(this, random(this)); | ||
}, | ||
[Symbol.iterator]() { | ||
return new SingleShotGen(new YieldWrap(this)); | ||
}, | ||
pipe() { | ||
return pipeArguments(this, arguments); | ||
} | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/option.js | ||
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option"); | ||
var CommonProto = { | ||
...EffectPrototype, | ||
[TypeId]: { | ||
_A: (_) => _ | ||
}, | ||
[NodeInspectSymbol]() { | ||
return this.toJSON(); | ||
}, | ||
toString() { | ||
return format(this.toJSON()); | ||
} | ||
}; | ||
var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), { | ||
_tag: "Some", | ||
_op: "Some", | ||
[symbol2](that) { | ||
return isOption(that) && isSome(that) && equals(this.value, that.value); | ||
}, | ||
[symbol]() { | ||
return cached(this, combine(hash(this._tag))(hash(this.value))); | ||
}, | ||
toJSON() { | ||
return { | ||
_id: "Option", | ||
_tag: this._tag, | ||
value: toJSON(this.value) | ||
}; | ||
} | ||
}); | ||
var NoneHash = /* @__PURE__ */ hash("None"); | ||
var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), { | ||
_tag: "None", | ||
_op: "None", | ||
[symbol2](that) { | ||
return isOption(that) && isNone(that); | ||
}, | ||
[symbol]() { | ||
return NoneHash; | ||
}, | ||
toJSON() { | ||
return { | ||
_id: "Option", | ||
_tag: this._tag | ||
}; | ||
} | ||
}); | ||
var isOption = (input) => hasProperty(input, TypeId); | ||
var isNone = (fa) => fa._tag === "None"; | ||
var isSome = (fa) => fa._tag === "Some"; | ||
var none = /* @__PURE__ */ Object.create(NoneProto); | ||
var some2 = (value) => { | ||
const a = Object.create(SomeProto); | ||
a.value = value; | ||
return a; | ||
}; | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/internal/either.js | ||
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either"); | ||
var CommonProto2 = { | ||
...EffectPrototype, | ||
[TypeId2]: { | ||
_R: (_) => _ | ||
}, | ||
[NodeInspectSymbol]() { | ||
return this.toJSON(); | ||
}, | ||
toString() { | ||
return format(this.toJSON()); | ||
} | ||
}; | ||
var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), { | ||
_tag: "Right", | ||
_op: "Right", | ||
[symbol2](that) { | ||
return isEither(that) && isRight(that) && equals(this.right, that.right); | ||
}, | ||
[symbol]() { | ||
return combine(hash(this._tag))(hash(this.right)); | ||
}, | ||
toJSON() { | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
right: toJSON(this.right) | ||
}; | ||
} | ||
}); | ||
var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), { | ||
_tag: "Left", | ||
_op: "Left", | ||
[symbol2](that) { | ||
return isEither(that) && isLeft(that) && equals(this.left, that.left); | ||
}, | ||
[symbol]() { | ||
return combine(hash(this._tag))(hash(this.left)); | ||
}, | ||
toJSON() { | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
left: toJSON(this.left) | ||
}; | ||
} | ||
}); | ||
var isEither = (input) => hasProperty(input, TypeId2); | ||
var isLeft = (ma) => ma._tag === "Left"; | ||
var isRight = (ma) => ma._tag === "Right"; | ||
var left = (left2) => { | ||
const a = Object.create(LeftProto); | ||
a.left = left2; | ||
return a; | ||
}; | ||
var right = (right2) => { | ||
const a = Object.create(RightProto); | ||
a.right = right2; | ||
return a; | ||
}; | ||
var getLeft = (self) => isRight(self) ? none : some2(self.left); | ||
var getRight = (self) => isLeft(self) ? none : some2(self.right); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Order.js | ||
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that); | ||
// ../../../node_modules/.pnpm/effect@3.12.1/node_modules/effect/dist/esm/Option.js | ||
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option"); | ||
var none2 = () => none; | ||
var some3 = some2; | ||
var isOption2 = isOption; | ||
var isNone2 = isNone; | ||
var isSome2 = isSome; | ||
var match = /* @__PURE__ */ dual(2, (self, { | ||
onNone, | ||
onSome | ||
}) => isNone2(self) ? onNone() : onSome(self.value)); | ||
var toRefinement = (f) => (a) => isSome2(f(a)); | ||
var fromIterable = (collection) => { | ||
for (const a of collection) { | ||
return some3(a); | ||
} | ||
return none2(); | ||
}; | ||
var getRight2 = getRight; | ||
var getLeft2 = getLeft; | ||
var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value); | ||
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self); | ||
var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some3(onNone()) : self); | ||
var orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map(that(), right) : map(self, left)); | ||
var firstSomeOf = (collection) => { | ||
let out = none2(); | ||
for (out of collection) { | ||
if (isSome2(out)) { | ||
return out; | ||
} | ||
} | ||
return out; | ||
}; | ||
var fromNullable = (nullableValue) => nullableValue == null ? none2() : some3(nullableValue); | ||
var liftNullable = (f) => (...a) => fromNullable(f(...a)); | ||
var getOrNull = /* @__PURE__ */ getOrElse(constNull); | ||
var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined); | ||
var liftThrowable = (f) => (...a) => { | ||
try { | ||
return some3(f(...a)); | ||
} catch (e) { | ||
return none2(); | ||
} | ||
}; | ||
var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onNone) => { | ||
if (isSome2(self)) { | ||
return self.value; | ||
} | ||
throw onNone(); | ||
}); | ||
var getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a None")); | ||
var map = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some3(f(self.value))); | ||
var as = /* @__PURE__ */ dual(2, (self, b) => map(self, () => b)); | ||
var asVoid = /* @__PURE__ */ as(undefined); | ||
var void_ = /* @__PURE__ */ some3(undefined); | ||
var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value)); | ||
var andThen = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => { | ||
const b = isFunction(f) ? f(a) : f; | ||
return isOption2(b) ? b : some3(b); | ||
})); | ||
var flatMapNullable = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : fromNullable(f(self.value))); | ||
var flatten = /* @__PURE__ */ flatMap(identity); | ||
var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that)); | ||
var composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a) => flatMap(afb(a), bfc)); | ||
var zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that)); | ||
var tap = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => map(f(a), () => a))); | ||
var product2 = (self, that) => isSome2(self) && isSome2(that) ? some3([self.value, that.value]) : none2(); | ||
var productMany2 = (self, collection) => { | ||
if (isNone2(self)) { | ||
return none2(); | ||
} | ||
const out = [self.value]; | ||
for (const o of collection) { | ||
if (isNone2(o)) { | ||
return none2(); | ||
} | ||
out.push(o.value); | ||
} | ||
return some3(out); | ||
}; | ||
var all2 = (input) => { | ||
if (Symbol.iterator in input) { | ||
const out2 = []; | ||
for (const o of input) { | ||
if (isNone2(o)) { | ||
return none2(); | ||
} | ||
out2.push(o.value); | ||
} | ||
return some3(out2); | ||
} | ||
const out = {}; | ||
for (const key of Object.keys(input)) { | ||
const o = input[key]; | ||
if (isNone2(o)) { | ||
return none2(); | ||
} | ||
out[key] = o.value; | ||
} | ||
return some3(out); | ||
}; | ||
var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => map(product2(self, that), ([a, b]) => f(a, b))); | ||
var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a))); | ||
var reduceCompact = /* @__PURE__ */ dual(3, (self, b, f) => { | ||
let out = b; | ||
for (const oa of self) { | ||
if (isSome2(oa)) { | ||
out = f(out, oa.value); | ||
} | ||
} | ||
return out; | ||
}); | ||
var toArray = (self) => isNone2(self) ? [] : [self.value]; | ||
var partitionMap = /* @__PURE__ */ dual(2, (self, f) => { | ||
if (isNone2(self)) { | ||
return [none2(), none2()]; | ||
} | ||
const e = f(self.value); | ||
return isLeft(e) ? [some3(e.left), none2()] : [none2(), some3(e.right)]; | ||
}); | ||
var filterMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value)); | ||
var filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b) => predicate(b) ? some2(b) : none)); | ||
var getEquivalence = (isEquivalent) => make((x, y) => isNone2(x) ? isNone2(y) : isNone2(y) ? false : isEquivalent(x.value, y.value)); | ||
var getOrder = (O) => make2((self, that) => isSome2(self) ? isSome2(that) ? O(self.value, that.value) : 1 : -1); | ||
var lift2 = (f) => dual(2, (self, that) => zipWith(self, that, f)); | ||
var liftPredicate = /* @__PURE__ */ dual(2, (b, predicate) => predicate(b) ? some3(b) : none2()); | ||
var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false : isEquivalent(self.value, a)); | ||
var _equivalence = /* @__PURE__ */ equivalence(); | ||
var contains = /* @__PURE__ */ containsWith(_equivalence); | ||
var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value)); | ||
var bindTo2 = /* @__PURE__ */ bindTo(map); | ||
var let_2 = /* @__PURE__ */ let_(map); | ||
var bind2 = /* @__PURE__ */ bind(map, flatMap); | ||
var Do = /* @__PURE__ */ some3({}); | ||
var adapter2 = /* @__PURE__ */ adapter(); | ||
var gen = (...args) => { | ||
let f; | ||
if (args.length === 1) { | ||
f = args[0]; | ||
} else { | ||
f = args[1].bind(args[0]); | ||
} | ||
const iterator = f(adapter2); | ||
let state = iterator.next(); | ||
if (state.done) { | ||
return some3(state.value); | ||
} else { | ||
let current = state.value; | ||
if (isGenKind(current)) { | ||
current = current.value; | ||
} else { | ||
current = yieldWrapGet(current); | ||
} | ||
if (isNone2(current)) { | ||
return current; | ||
} | ||
while (!state.done) { | ||
state = iterator.next(current.value); | ||
if (!state.done) { | ||
current = state.value; | ||
if (isGenKind(current)) { | ||
current = current.value; | ||
} else { | ||
current = yieldWrapGet(current); | ||
} | ||
if (isNone2(current)) { | ||
return current; | ||
} | ||
} | ||
} | ||
return some3(state.value); | ||
} | ||
}; | ||
exports.F = Function_exports; | ||
exports.O = Option_exports; | ||
exports.all = all; | ||
exports.and = and; | ||
exports.compose = compose2; | ||
exports.eqv = eqv; | ||
exports.every = every; | ||
exports.hasProperty = hasProperty; | ||
exports.implies = implies; | ||
exports.isBigInt = isBigInt; | ||
exports.isBoolean = isBoolean; | ||
exports.isDate = isDate; | ||
exports.isError = isError; | ||
exports.isFunction = isFunction2; | ||
exports.isIterable = isIterable; | ||
exports.isMap = isMap; | ||
exports.isNever = isNever; | ||
exports.isNotNull = isNotNull; | ||
exports.isNotNullable = isNotNullable; | ||
exports.isNotUndefined = isNotUndefined; | ||
exports.isNull = isNull; | ||
exports.isNullable = isNullable; | ||
exports.isNumber = isNumber; | ||
exports.BiRecord = BiRecord; | ||
exports._ = _; | ||
exports.birecord = birecord; | ||
exports.dual = dual; | ||
exports.entries = entries; | ||
exports.flip = flip; | ||
exports.flow = flow; | ||
exports.fromEntries = fromEntries; | ||
exports.identity = identity; | ||
exports.isArray = isArray; | ||
exports.isObject = isObject; | ||
exports.isPromise = isPromise; | ||
exports.isPromiseLike = isPromiseLike; | ||
exports.isReadonlyRecord = isReadonlyRecord; | ||
exports.isRecord = isRecord; | ||
exports.isRecordOrArray = isRecordOrArray; | ||
exports.isRegExp = isRegExp; | ||
exports.isSet = isSet; | ||
exports.isString = isString; | ||
exports.isSymbol = isSymbol; | ||
exports.isTagged = isTagged; | ||
exports.isTruthy = isTruthy; | ||
exports.isTupleOf = isTupleOf; | ||
exports.isTupleOfAtLeast = isTupleOfAtLeast; | ||
exports.isUint8Array = isUint8Array; | ||
exports.isUndefined = isUndefined; | ||
exports.isUnknown = isUnknown; | ||
exports.mapInput = mapInput; | ||
exports.nand = nand; | ||
exports.nor = nor; | ||
exports.not = not; | ||
exports.or = or; | ||
exports.product = product; | ||
exports.productMany = productMany; | ||
exports.some = some; | ||
exports.struct = struct; | ||
exports.tuple = tuple; | ||
exports.xor = xor; | ||
exports.pipe = pipe; | ||
exports.returnFalse = returnFalse; | ||
exports.returnTrue = returnTrue; | ||
exports.returnVoid = returnVoid; |
{ | ||
"name": "@eslint-react/eff", | ||
"version": "1.23.3-next.8", | ||
"description": "A subset of effect to produce a more lightweight version of the library.", | ||
"homepage": "https://github.com/rEl1cx/eslint-react", | ||
"version": "1.24.0-next.0", | ||
"description": "JavaScript and TypeScript utilities (previously some re-exports of the effect library).", | ||
"homepage": "https://github.com/Rel1cx/eslint-react", | ||
"bugs": { | ||
"url": "https://github.com/rEl1cx/eslint-react/issues" | ||
"url": "https://github.com/Rel1cx/eslint-react/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rEl1cx/eslint-react.git", | ||
"url": "git+https://github.com/Rel1cx/eslint-react.git", | ||
"directory": "packages/utilities/eff" | ||
@@ -36,3 +36,2 @@ }, | ||
"devDependencies": { | ||
"effect": "^3.12.1", | ||
"tsup": "^8.3.5", | ||
@@ -39,0 +38,0 @@ "@workspace/configs": "0.0.0" |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
2
48946
680
1