UNPKG

functionalscript

Version:

FunctionalScript is a purely functional subset of JavaScript

21 lines (20 loc) 690 B
import type { Index3, Index5, Array2 } from '../../array/module.f.ts'; export type Sign = -1 | 0 | 1; export type Compare<T> = (_: T) => Sign; export declare const index3: <T>(cmp: Compare<T>) => (value: T) => Index3; export declare const index5: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5; export type Cmp1 = boolean | string | number | bigint; export type Cmp2<A, B> = [ A, B ] extends [boolean, boolean] ? boolean : [ A, B ] extends [string, string] ? string : [ A, B ] extends [number, number] ? number : [ A, B ] extends [bigint, bigint] ? bigint : never; export declare const cmp: <A extends Cmp1>(a: A) => <B extends Cmp2<A, B>>(b: B) => Sign;