diff --git a/dist/functions.d.ts b/dist/app/functions.d.ts similarity index 100% rename from dist/functions.d.ts rename to dist/app/functions.d.ts diff --git a/dist/functions.js b/dist/app/functions.js similarity index 100% rename from dist/functions.js rename to dist/app/functions.js diff --git a/dist/app/functions/F.d.ts b/dist/app/functions/F.d.ts new file mode 100644 index 00000000..aa39b8eb --- /dev/null +++ b/dist/app/functions/F.d.ts @@ -0,0 +1 @@ +export declare const F: (...ignored: unknown[]) => false; diff --git a/dist/app/functions/F.js b/dist/app/functions/F.js new file mode 100644 index 00000000..3642d499 --- /dev/null +++ b/dist/app/functions/F.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.F = void 0; +exports.F = (...ignored) => false; diff --git a/dist/app/functions/T.d.ts b/dist/app/functions/T.d.ts new file mode 100644 index 00000000..e81bbc5c --- /dev/null +++ b/dist/app/functions/T.d.ts @@ -0,0 +1 @@ +export declare const T: (...ignored: unknown[]) => true; diff --git a/dist/app/functions/T.js b/dist/app/functions/T.js new file mode 100644 index 00000000..89ad8699 --- /dev/null +++ b/dist/app/functions/T.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.T = void 0; +exports.T = (...ignored) => true; diff --git a/dist/app/functions/always.d.ts b/dist/app/functions/always.d.ts new file mode 100644 index 00000000..e9308d26 --- /dev/null +++ b/dist/app/functions/always.d.ts @@ -0,0 +1 @@ +export declare const always: (a: A) => (...bs: unknown[]) => A; diff --git a/dist/app/functions/always.js b/dist/app/functions/always.js new file mode 100644 index 00000000..d4fa611c --- /dev/null +++ b/dist/app/functions/always.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.always = void 0; +exports.always = (a) => (...bs) => a; diff --git a/dist/app/functions/assoc.d.ts b/dist/app/functions/assoc.d.ts new file mode 100644 index 00000000..cc173b0b --- /dev/null +++ b/dist/app/functions/assoc.d.ts @@ -0,0 +1,3 @@ +export declare const assoc: (k: K) => (b: B) => (a: A) => A | { + K: B; +}; diff --git a/dist/app/functions/assoc.js b/dist/app/functions/assoc.js new file mode 100644 index 00000000..18e6f865 --- /dev/null +++ b/dist/app/functions/assoc.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assoc = void 0; +const clone_1 = require("./clone"); +exports.assoc = (k) => (b) => (a) => Object.assign(clone_1.clone(a), { [k]: b }); diff --git a/dist/app/functions/bind.d.ts b/dist/app/functions/bind.d.ts new file mode 100644 index 00000000..3983dabc --- /dev/null +++ b/dist/app/functions/bind.d.ts @@ -0,0 +1 @@ +export declare const bind: (m: M) => (b: ThisParameterType) => OmitThisParameter; diff --git a/dist/app/functions/bind.js b/dist/app/functions/bind.js new file mode 100644 index 00000000..3646d8c7 --- /dev/null +++ b/dist/app/functions/bind.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bind = void 0; +exports.bind = (m) => (b) => m.bind(b); diff --git a/dist/app/functions/blackbird.d.ts b/dist/app/functions/blackbird.d.ts new file mode 100644 index 00000000..4bde3540 --- /dev/null +++ b/dist/app/functions/blackbird.d.ts @@ -0,0 +1 @@ +export declare const blackbird: (converging: (...bs: BS) => C) => (...parts: ((a: A) => unknown)[]) => (a: A) => C; diff --git a/dist/app/functions/blackbird.js b/dist/app/functions/blackbird.js new file mode 100644 index 00000000..d62c32ab --- /dev/null +++ b/dist/app/functions/blackbird.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.blackbird = void 0; +exports.blackbird = (converging) => (...parts) => (a) => { + const bs = parts.map((part) => part(a)); + return converging(...bs); +}; diff --git a/dist/app/functions/both.d.ts b/dist/app/functions/both.d.ts new file mode 100644 index 00000000..3a0150b0 --- /dev/null +++ b/dist/app/functions/both.d.ts @@ -0,0 +1 @@ +export declare const both: (first: (a: A) => B) => (second: (a: A) => C) => (a: A) => B | C; diff --git a/dist/app/functions/both.js b/dist/app/functions/both.js new file mode 100644 index 00000000..616f764f --- /dev/null +++ b/dist/app/functions/both.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.both = void 0; +exports.both = (first) => (second) => (a) => first(a) && second(a); diff --git a/dist/app/functions/cap.d.ts b/dist/app/functions/cap.d.ts new file mode 100644 index 00000000..2c785167 --- /dev/null +++ b/dist/app/functions/cap.d.ts @@ -0,0 +1 @@ +export declare const cap: (word: string) => string; diff --git a/dist/functions/cap.js b/dist/app/functions/cap.js similarity index 71% rename from dist/functions/cap.js rename to dist/app/functions/cap.js index 4dc71e4f..1e04b50a 100644 --- a/dist/functions/cap.js +++ b/dist/app/functions/cap.js @@ -1,12 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cap = void 0; -/** - * ``` - * cap :: s => s - * ``` - * @param {string} word word we want to capitalize - */ exports.cap = (word) => typeof word === "string" && word.length > 0 ? word[0].toLocaleUpperCase() + word.substr(1) : word; diff --git a/dist/app/functions/clone.d.ts b/dist/app/functions/clone.d.ts new file mode 100644 index 00000000..803f49ff --- /dev/null +++ b/dist/app/functions/clone.d.ts @@ -0,0 +1 @@ +export declare function clone(a: A): A; diff --git a/dist/functions/clone.js b/dist/app/functions/clone.js similarity index 74% rename from dist/functions/clone.js rename to dist/app/functions/clone.js index e2ed970d..43f87450 100644 --- a/dist/functions/clone.js +++ b/dist/app/functions/clone.js @@ -1,8 +1,10 @@ "use strict"; -/* eslint-disable @typescript-eslint/ban-types -- WeakMap needs an object type */ Object.defineProperty(exports, "__esModule", { value: true }); exports.clone = void 0; -const functions_1 = require("../functions"); +const isArray_1 = require("./isArray"); +const isDate_1 = require("./isDate"); +const isObject_1 = require("./isObject"); +const isDefined_1 = require("./isDefined"); function cloneObject(a, map) { if (map.has(a)) { return map.get(a); @@ -33,26 +35,17 @@ function cloneArray(a, map) { } } function cloneUnknown(a, map) { - const t = functions_1.isDefined(a) - ? functions_1.isDate(a) + const t = isDefined_1.isDefined(a) + ? isDate_1.isDate(a) ? cloneDate(a) - : functions_1.isArray(a) + : isArray_1.isArray(a) ? cloneArray(a, map) - : functions_1.isObject(a) + : isObject_1.isObject(a) ? cloneObject(a, map) : a : a; return t; } -/** - * ``` - * clone :: a => a - * ``` - * @export - * @template A - * @param {A} a - * @returns {A} - */ function clone(a) { const map = new WeakMap(); return cloneUnknown(a, map); diff --git a/dist/app/functions/complement.d.ts b/dist/app/functions/complement.d.ts new file mode 100644 index 00000000..37fd53ca --- /dev/null +++ b/dist/app/functions/complement.d.ts @@ -0,0 +1 @@ +export declare const complement: (predicate: (a: A) => boolean) => (a: A) => boolean; diff --git a/dist/app/functions/complement.js b/dist/app/functions/complement.js new file mode 100644 index 00000000..5a3947ae --- /dev/null +++ b/dist/app/functions/complement.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.complement = void 0; +exports.complement = (predicate) => (a) => !predicate(a); diff --git a/dist/app/functions/compose.d.ts b/dist/app/functions/compose.d.ts new file mode 100644 index 00000000..31af862f --- /dev/null +++ b/dist/app/functions/compose.d.ts @@ -0,0 +1,9 @@ +import { Last } from "../types"; +export declare type Compose = { + (b: B): A; + call(a: A): B; + from(f: (c: C) => B): Compose; +}; +export declare const compose: ( any)[]>(...fs: FS) => (a: Parameters>[0]) => ReturnType) & { + fluent: (f: (b: B) => A) => Compose; +}; diff --git a/dist/app/functions/compose.js b/dist/app/functions/compose.js new file mode 100644 index 00000000..ef1ed90a --- /dev/null +++ b/dist/app/functions/compose.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.compose = void 0; +const fluent = (f) => { + function call(b) { + return f(b); + } + const p = Object.assign(call.bind(null), { + from: (f) => { + return after(p, f); + }, + call, + }); + return p; +}; +const after = (next, f) => { + function call(c) { + return next(f(c)); + } + const p = Object.assign(call.bind(null), { + from: (f) => { + return after(p, f); + }, + call, + }); + return p; +}; +exports.compose = Object.assign((...fs) => { + return (a) => fs.reduceRight((v, f) => f(v), a); +}, { fluent }); diff --git a/dist/app/functions/concat.d.ts b/dist/app/functions/concat.d.ts new file mode 100644 index 00000000..b6e1e961 --- /dev/null +++ b/dist/app/functions/concat.d.ts @@ -0,0 +1 @@ +export declare const concat: (as: A) => (bs: B) => [...A, ...B]; diff --git a/dist/app/functions/concat.js b/dist/app/functions/concat.js new file mode 100644 index 00000000..b6b9e30b --- /dev/null +++ b/dist/app/functions/concat.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.concat = void 0; +exports.concat = (as) => (bs) => [...as, ...bs]; diff --git a/dist/app/functions/curry.d.ts b/dist/app/functions/curry.d.ts new file mode 100644 index 00000000..787f1d27 --- /dev/null +++ b/dist/app/functions/curry.d.ts @@ -0,0 +1 @@ +export declare const curry: (f: F) => Function; diff --git a/dist/app/functions/curry.js b/dist/app/functions/curry.js new file mode 100644 index 00000000..47f4b2d4 --- /dev/null +++ b/dist/app/functions/curry.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.curry = void 0; +const curryN_1 = require("./curryN"); +exports.curry = (f) => curryN_1.curryN(f.length)(f); diff --git a/dist/app/functions/curryN.d.ts b/dist/app/functions/curryN.d.ts new file mode 100644 index 00000000..dd8203e3 --- /dev/null +++ b/dist/app/functions/curryN.d.ts @@ -0,0 +1 @@ +export declare const curryN: (n: number) => (f: F) => Function; diff --git a/dist/functions/curryN.js b/dist/app/functions/curryN.js similarity index 59% rename from dist/functions/curryN.js rename to dist/app/functions/curryN.js index 72ea8175..d586c622 100644 --- a/dist/functions/curryN.js +++ b/dist/app/functions/curryN.js @@ -13,14 +13,4 @@ const gather = (n, f, previous = []) => { }); return curried; }; -/** - * ``` - * curryN :: n => ((a¹, a², ..., aⁿ) => b) => a¹ => a²... => aⁿ => b - * ``` - * ----------------------------------------------------------------------------- - * Converts a function that accepts an arity, __n__, number of arguments into a - * series of _Unary_ functions that produce the same final value. - * - * @todo add support for Variadic Tuples in TypeScript 4 - */ exports.curryN = (n) => (f) => gather(n, f); diff --git a/dist/app/functions/defaultTo.d.ts b/dist/app/functions/defaultTo.d.ts new file mode 100644 index 00000000..6b357cd7 --- /dev/null +++ b/dist/app/functions/defaultTo.d.ts @@ -0,0 +1 @@ +export declare const defaultTo: (a: A) => (b: B) => A | B; diff --git a/dist/app/functions/defaultTo.js b/dist/app/functions/defaultTo.js new file mode 100644 index 00000000..5ba00741 --- /dev/null +++ b/dist/app/functions/defaultTo.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultTo = void 0; +const isDefined_1 = require("./isDefined"); +const isNaN_1 = require("./isNaN"); +exports.defaultTo = (a) => (b) => isNaN_1.isNaN(b) ? a : isDefined_1.isDefined(b) ? b : a; diff --git a/dist/app/functions/either.d.ts b/dist/app/functions/either.d.ts new file mode 100644 index 00000000..ed829656 --- /dev/null +++ b/dist/app/functions/either.d.ts @@ -0,0 +1 @@ +export declare const either: (mapAB: (a: A) => B) => (mapAC: (a: A) => C) => (a: A) => B | C; diff --git a/dist/app/functions/either.js b/dist/app/functions/either.js new file mode 100644 index 00000000..f0f8fb36 --- /dev/null +++ b/dist/app/functions/either.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.either = void 0; +exports.either = (mapAB) => (mapAC) => (a) => mapAB(a) || mapAC(a); diff --git a/dist/app/functions/equals.d.ts b/dist/app/functions/equals.d.ts new file mode 100644 index 00000000..f3d89ae7 --- /dev/null +++ b/dist/app/functions/equals.d.ts @@ -0,0 +1 @@ +export declare const equals: (a: unknown) => (b: unknown) => boolean; diff --git a/dist/app/functions/equals.js b/dist/app/functions/equals.js new file mode 100644 index 00000000..7720a15c --- /dev/null +++ b/dist/app/functions/equals.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.equals = void 0; +exports.equals = (a) => (b) => a === b; diff --git a/dist/app/functions/filter.d.ts b/dist/app/functions/filter.d.ts new file mode 100644 index 00000000..f0658d67 --- /dev/null +++ b/dist/app/functions/filter.d.ts @@ -0,0 +1 @@ +export declare const filter: (p: (a: A) => boolean) => (as: A[]) => A[]; diff --git a/dist/app/functions/filter.js b/dist/app/functions/filter.js new file mode 100644 index 00000000..498d2976 --- /dev/null +++ b/dist/app/functions/filter.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.filter = void 0; +exports.filter = (p) => (as) => as.filter(p); diff --git a/dist/app/functions/has.d.ts b/dist/app/functions/has.d.ts new file mode 100644 index 00000000..5048a113 --- /dev/null +++ b/dist/app/functions/has.d.ts @@ -0,0 +1 @@ +export declare const has: (k: K) => (a: unknown) => a is { [P in K]: unknown; }; diff --git a/dist/app/functions/has.js b/dist/app/functions/has.js new file mode 100644 index 00000000..178928e3 --- /dev/null +++ b/dist/app/functions/has.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.has = void 0; +exports.has = (k) => (a) => Object.prototype.hasOwnProperty.call(a, k); diff --git a/dist/app/functions/head.d.ts b/dist/app/functions/head.d.ts new file mode 100644 index 00000000..6b2a8aef --- /dev/null +++ b/dist/app/functions/head.d.ts @@ -0,0 +1 @@ +export declare const head: (as: A[]) => A; diff --git a/dist/app/functions/head.js b/dist/app/functions/head.js new file mode 100644 index 00000000..c79e2029 --- /dev/null +++ b/dist/app/functions/head.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.head = void 0; +exports.head = (as) => as[0]; diff --git a/dist/app/functions/identity.d.ts b/dist/app/functions/identity.d.ts new file mode 100644 index 00000000..c4279d0c --- /dev/null +++ b/dist/app/functions/identity.d.ts @@ -0,0 +1 @@ +export declare const identity: (a: A) => A; diff --git a/dist/app/functions/identity.js b/dist/app/functions/identity.js new file mode 100644 index 00000000..72865198 --- /dev/null +++ b/dist/app/functions/identity.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.identity = void 0; +exports.identity = (a) => a; diff --git a/dist/functions/ifElse.d.ts b/dist/app/functions/ifElse.d.ts similarity index 100% rename from dist/functions/ifElse.d.ts rename to dist/app/functions/ifElse.d.ts diff --git a/dist/functions/ifElse.js b/dist/app/functions/ifElse.js similarity index 100% rename from dist/functions/ifElse.js rename to dist/app/functions/ifElse.js diff --git a/dist/app/functions/iife.d.ts b/dist/app/functions/iife.d.ts new file mode 100644 index 00000000..f49f312e --- /dev/null +++ b/dist/app/functions/iife.d.ts @@ -0,0 +1 @@ +export declare const iife: (f: (...as: AS) => B, ...as: AS) => B; diff --git a/dist/app/functions/iife.js b/dist/app/functions/iife.js new file mode 100644 index 00000000..b501e128 --- /dev/null +++ b/dist/app/functions/iife.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.iife = void 0; +exports.iife = (f, ...as) => f(...as); diff --git a/dist/app/functions/init.d.ts b/dist/app/functions/init.d.ts new file mode 100644 index 00000000..82427750 --- /dev/null +++ b/dist/app/functions/init.d.ts @@ -0,0 +1 @@ +export declare const init: (as: A[]) => A[]; diff --git a/dist/app/functions/init.js b/dist/app/functions/init.js new file mode 100644 index 00000000..e806a239 --- /dev/null +++ b/dist/app/functions/init.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.init = void 0; +exports.init = (as) => as.slice(0, as.length - 1); diff --git a/dist/app/functions/invoker.d.ts b/dist/app/functions/invoker.d.ts new file mode 100644 index 00000000..a3cdc9b4 --- /dev/null +++ b/dist/app/functions/invoker.d.ts @@ -0,0 +1 @@ +export declare const invoker: (k: K) => (...as: AS) => (c: { [_ in K]: (...as: AS) => B; }) => B; diff --git a/dist/app/functions/invoker.js b/dist/app/functions/invoker.js new file mode 100644 index 00000000..93da2577 --- /dev/null +++ b/dist/app/functions/invoker.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.invoker = void 0; +exports.invoker = (k) => (...as) => (c) => c[k](...as); diff --git a/dist/app/functions/isArray.d.ts b/dist/app/functions/isArray.d.ts new file mode 100644 index 00000000..a920d3f4 --- /dev/null +++ b/dist/app/functions/isArray.d.ts @@ -0,0 +1 @@ +export declare const isArray: (arg: any) => arg is any[]; diff --git a/dist/app/functions/isArray.js b/dist/app/functions/isArray.js new file mode 100644 index 00000000..7af4badb --- /dev/null +++ b/dist/app/functions/isArray.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isArray = void 0; +exports.isArray = Array.isArray; diff --git a/dist/app/functions/isDate.d.ts b/dist/app/functions/isDate.d.ts new file mode 100644 index 00000000..1c785258 --- /dev/null +++ b/dist/app/functions/isDate.d.ts @@ -0,0 +1 @@ +export declare const isDate: (a: unknown) => a is Date; diff --git a/dist/app/functions/isDate.js b/dist/app/functions/isDate.js new file mode 100644 index 00000000..4a8a31f6 --- /dev/null +++ b/dist/app/functions/isDate.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isDate = void 0; +exports.isDate = (a) => a instanceof Date; diff --git a/dist/app/functions/isDefined.d.ts b/dist/app/functions/isDefined.d.ts new file mode 100644 index 00000000..699dd416 --- /dev/null +++ b/dist/app/functions/isDefined.d.ts @@ -0,0 +1 @@ +export declare const isDefined: (a: A) => a is Exclude & Exclude; diff --git a/dist/app/functions/isDefined.js b/dist/app/functions/isDefined.js new file mode 100644 index 00000000..2e94c647 --- /dev/null +++ b/dist/app/functions/isDefined.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isDefined = void 0; +exports.isDefined = (a) => a != null; diff --git a/dist/app/functions/isEmpty.d.ts b/dist/app/functions/isEmpty.d.ts new file mode 100644 index 00000000..98e0c340 --- /dev/null +++ b/dist/app/functions/isEmpty.d.ts @@ -0,0 +1 @@ +export declare const isEmpty: (a: unknown) => boolean; diff --git a/dist/app/functions/isEmpty.js b/dist/app/functions/isEmpty.js new file mode 100644 index 00000000..80b1c892 --- /dev/null +++ b/dist/app/functions/isEmpty.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEmpty = void 0; +exports.isEmpty = (a) => (Array.isArray(a) && a.length === 0) || + (typeof a === "string" && a.length === 0) || + (typeof a === "object" && a !== null && Object.keys(a).length === 0); diff --git a/dist/app/functions/isFunction.d.ts b/dist/app/functions/isFunction.d.ts new file mode 100644 index 00000000..278d7991 --- /dev/null +++ b/dist/app/functions/isFunction.d.ts @@ -0,0 +1 @@ +export declare const isFunction: (a: unknown) => a is Function; diff --git a/dist/app/functions/isFunction.js b/dist/app/functions/isFunction.js new file mode 100644 index 00000000..9645569a --- /dev/null +++ b/dist/app/functions/isFunction.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isFunction = void 0; +exports.isFunction = (a) => typeof a === "function"; diff --git a/dist/app/functions/isNaN.d.ts b/dist/app/functions/isNaN.d.ts new file mode 100644 index 00000000..1d9282c3 --- /dev/null +++ b/dist/app/functions/isNaN.d.ts @@ -0,0 +1 @@ +export declare const isNaN: (a: unknown) => a is number; diff --git a/dist/app/functions/isNaN.js b/dist/app/functions/isNaN.js new file mode 100644 index 00000000..d46207e7 --- /dev/null +++ b/dist/app/functions/isNaN.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isNaN = void 0; +exports.isNaN = (a) => Number.isNaN(a); diff --git a/dist/app/functions/isNil.d.ts b/dist/app/functions/isNil.d.ts new file mode 100644 index 00000000..e1d594d4 --- /dev/null +++ b/dist/app/functions/isNil.d.ts @@ -0,0 +1 @@ +export declare const isNil: (a: unknown) => a is null | undefined; diff --git a/dist/app/functions/isNil.js b/dist/app/functions/isNil.js new file mode 100644 index 00000000..f976bbbd --- /dev/null +++ b/dist/app/functions/isNil.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isNil = void 0; +exports.isNil = (a) => a === null || a === undefined; diff --git a/dist/app/functions/isNumber.d.ts b/dist/app/functions/isNumber.d.ts new file mode 100644 index 00000000..b8c3c6b1 --- /dev/null +++ b/dist/app/functions/isNumber.d.ts @@ -0,0 +1 @@ +export declare const isNumber: (a: unknown) => a is number; diff --git a/dist/app/functions/isNumber.js b/dist/app/functions/isNumber.js new file mode 100644 index 00000000..56f34417 --- /dev/null +++ b/dist/app/functions/isNumber.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isNumber = void 0; +exports.isNumber = (a) => typeof a === "number"; diff --git a/dist/app/functions/isObject.d.ts b/dist/app/functions/isObject.d.ts new file mode 100644 index 00000000..80496f55 --- /dev/null +++ b/dist/app/functions/isObject.d.ts @@ -0,0 +1 @@ +export declare const isObject: (a: unknown) => a is object; diff --git a/dist/app/functions/isObject.js b/dist/app/functions/isObject.js new file mode 100644 index 00000000..cbdaeda8 --- /dev/null +++ b/dist/app/functions/isObject.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isObject = void 0; +exports.isObject = (a) => typeof a === "object"; diff --git a/dist/app/functions/isString.d.ts b/dist/app/functions/isString.d.ts new file mode 100644 index 00000000..c0965a98 --- /dev/null +++ b/dist/app/functions/isString.d.ts @@ -0,0 +1 @@ +export declare const isString: (a: unknown) => a is string; diff --git a/dist/app/functions/isString.js b/dist/app/functions/isString.js new file mode 100644 index 00000000..37c4ba0a --- /dev/null +++ b/dist/app/functions/isString.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isString = void 0; +exports.isString = (a) => typeof a === "string"; diff --git a/dist/app/functions/join.d.ts b/dist/app/functions/join.d.ts new file mode 100644 index 00000000..86ded529 --- /dev/null +++ b/dist/app/functions/join.d.ts @@ -0,0 +1 @@ +export declare const join: (a: string | undefined) => (bs: A[]) => string; diff --git a/dist/app/functions/join.js b/dist/app/functions/join.js new file mode 100644 index 00000000..9f59ed34 --- /dev/null +++ b/dist/app/functions/join.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.join = void 0; +exports.join = (a) => (bs) => bs.join(a); diff --git a/dist/app/functions/last.d.ts b/dist/app/functions/last.d.ts new file mode 100644 index 00000000..00382fc4 --- /dev/null +++ b/dist/app/functions/last.d.ts @@ -0,0 +1 @@ +export declare const last: (as: A[]) => A; diff --git a/dist/app/functions/last.js b/dist/app/functions/last.js new file mode 100644 index 00000000..a0265f30 --- /dev/null +++ b/dist/app/functions/last.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.last = void 0; +exports.last = (as) => as[as.length - 1]; diff --git a/dist/app/functions/log.d.ts b/dist/app/functions/log.d.ts new file mode 100644 index 00000000..99297edd --- /dev/null +++ b/dist/app/functions/log.d.ts @@ -0,0 +1 @@ +export declare const log: (s: string) => (a: A) => A; diff --git a/dist/app/functions/log.js b/dist/app/functions/log.js new file mode 100644 index 00000000..e9f2dfcd --- /dev/null +++ b/dist/app/functions/log.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.log = void 0; +exports.log = (s) => (a) => { + console.groupCollapsed(s); + console.log(a); + console.groupEnd(); + return a; +}; diff --git a/dist/functions/map.d.ts b/dist/app/functions/map.d.ts similarity index 100% rename from dist/functions/map.d.ts rename to dist/app/functions/map.d.ts diff --git a/dist/functions/map.js b/dist/app/functions/map.js similarity index 100% rename from dist/functions/map.js rename to dist/app/functions/map.js diff --git a/dist/app/functions/merge.d.ts b/dist/app/functions/merge.d.ts new file mode 100644 index 00000000..d9743abb --- /dev/null +++ b/dist/app/functions/merge.d.ts @@ -0,0 +1 @@ +export declare const merge: (a: A) => (b: B) => A & B; diff --git a/dist/app/functions/merge.js b/dist/app/functions/merge.js new file mode 100644 index 00000000..ef2c2fe4 --- /dev/null +++ b/dist/app/functions/merge.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.merge = void 0; +exports.merge = (a) => (b) => Object.assign({}, a, b); diff --git a/dist/app/functions/not.d.ts b/dist/app/functions/not.d.ts new file mode 100644 index 00000000..700e33d7 --- /dev/null +++ b/dist/app/functions/not.d.ts @@ -0,0 +1 @@ +export declare const not: (a: unknown) => boolean; diff --git a/dist/app/functions/not.js b/dist/app/functions/not.js new file mode 100644 index 00000000..12461948 --- /dev/null +++ b/dist/app/functions/not.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.not = void 0; +exports.not = (a) => !a; diff --git a/dist/app/functions/partial.d.ts b/dist/app/functions/partial.d.ts new file mode 100644 index 00000000..e937ec68 --- /dev/null +++ b/dist/app/functions/partial.d.ts @@ -0,0 +1,2 @@ +export declare const partial: (...as: AS) => (f: (...args_0: AS, ...args_1: BS) => C) => (...bs: BS) => C; +export declare type Args = readonly unknown[]; diff --git a/dist/app/functions/partial.js b/dist/app/functions/partial.js new file mode 100644 index 00000000..80b84285 --- /dev/null +++ b/dist/app/functions/partial.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.partial = void 0; +exports.partial = (...as) => (f) => (...bs) => f(...as, ...bs); diff --git a/dist/app/functions/pipe.d.ts b/dist/app/functions/pipe.d.ts new file mode 100644 index 00000000..0976ca43 --- /dev/null +++ b/dist/app/functions/pipe.d.ts @@ -0,0 +1,9 @@ +import { Last } from "../types"; +export declare type Pipe = { + (a: A): B; + then: (f: (b: B) => C) => Pipe; + invoke(a: A): B; +}; +export declare const pipe: ( any)[]>(...fs: FS) => (a: Parameters[0]) => ReturnType>) & { + fluent: (f: (a: A) => B) => Pipe; +}; diff --git a/dist/app/functions/pipe.js b/dist/app/functions/pipe.js new file mode 100644 index 00000000..99184f7c --- /dev/null +++ b/dist/app/functions/pipe.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pipe = void 0; +const fluent = (f) => { + function invoke(a) { + return f(a); + } + const p = Object.assign(invoke.bind(null), { + then: (f) => { + return next(p, f); + }, + invoke, + }); + return p; +}; +const next = (prev, f) => { + function invoke(a) { + return f(prev(a)); + } + const p = Object.assign(invoke.bind(null), { + then: (f) => { + return next(p, f); + }, + invoke, + }); + return p; +}; +exports.pipe = Object.assign((...fs) => { + return (a) => fs.reduce((v, f) => f(v), a); +}, { fluent }); diff --git a/dist/app/functions/pipeV.d.ts b/dist/app/functions/pipeV.d.ts new file mode 100644 index 00000000..76a4ebb7 --- /dev/null +++ b/dist/app/functions/pipeV.d.ts @@ -0,0 +1 @@ +export declare const pipeV: (...as: A[]) => (f: F, ...fs: Function[]) => any; diff --git a/dist/app/functions/pipeV.js b/dist/app/functions/pipeV.js new file mode 100644 index 00000000..fcba01bb --- /dev/null +++ b/dist/app/functions/pipeV.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pipeV = void 0; +exports.pipeV = (...as) => (f, ...fs) => fs.reduce((a, f) => f(a), f(...as)); diff --git a/dist/app/functions/prop.d.ts b/dist/app/functions/prop.d.ts new file mode 100644 index 00000000..62e73ae3 --- /dev/null +++ b/dist/app/functions/prop.d.ts @@ -0,0 +1 @@ +export declare const prop: (k: K) => (a: { [P in K]: B; }) => B; diff --git a/dist/app/functions/prop.js b/dist/app/functions/prop.js new file mode 100644 index 00000000..6ffc9e5d --- /dev/null +++ b/dist/app/functions/prop.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prop = void 0; +exports.prop = (k) => (a) => a[k]; diff --git a/dist/functions/reduce.d.ts b/dist/app/functions/reduce.d.ts similarity index 100% rename from dist/functions/reduce.d.ts rename to dist/app/functions/reduce.d.ts diff --git a/dist/functions/reduce.js b/dist/app/functions/reduce.js similarity index 100% rename from dist/functions/reduce.js rename to dist/app/functions/reduce.js diff --git a/dist/app/functions/reduceRight.d.ts b/dist/app/functions/reduceRight.d.ts new file mode 100644 index 00000000..8c0d40c0 --- /dev/null +++ b/dist/app/functions/reduceRight.d.ts @@ -0,0 +1 @@ +export declare const reduceRight: (reducer: (a: A, b: B) => A) => (a: A) => (bs: B[]) => A; diff --git a/dist/app/functions/reduceRight.js b/dist/app/functions/reduceRight.js new file mode 100644 index 00000000..150be6d3 --- /dev/null +++ b/dist/app/functions/reduceRight.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reduceRight = void 0; +exports.reduceRight = (reducer) => (a) => (bs) => (bs.length > 0 ? bs.reduceRight(reducer, a) : a); diff --git a/dist/app/functions/replace.d.ts b/dist/app/functions/replace.d.ts new file mode 100644 index 00000000..61b55810 --- /dev/null +++ b/dist/app/functions/replace.d.ts @@ -0,0 +1 @@ +export declare const replace: (searchValue: string | RegExp) => (replaceValue: string) => (within: string) => string; diff --git a/dist/app/functions/replace.js b/dist/app/functions/replace.js new file mode 100644 index 00000000..95498663 --- /dev/null +++ b/dist/app/functions/replace.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.replace = void 0; +exports.replace = (searchValue) => (replaceValue) => (within) => within.replace(searchValue, replaceValue); diff --git a/dist/app/functions/reverse.d.ts b/dist/app/functions/reverse.d.ts new file mode 100644 index 00000000..3f0e75ad --- /dev/null +++ b/dist/app/functions/reverse.d.ts @@ -0,0 +1 @@ +export declare const reverse: (as: ArrayLike) => A[]; diff --git a/dist/app/functions/reverse.js b/dist/app/functions/reverse.js new file mode 100644 index 00000000..78210617 --- /dev/null +++ b/dist/app/functions/reverse.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reverse = void 0; +exports.reverse = (as) => Array.from(as).reverse(); diff --git a/dist/app/functions/slice.d.ts b/dist/app/functions/slice.d.ts new file mode 100644 index 00000000..caed52c1 --- /dev/null +++ b/dist/app/functions/slice.d.ts @@ -0,0 +1 @@ +export declare const slice: (n?: number | undefined) => (m?: number | undefined) => (as: Iterable | ArrayLike) => A[]; diff --git a/dist/app/functions/slice.js b/dist/app/functions/slice.js new file mode 100644 index 00000000..b81e66d1 --- /dev/null +++ b/dist/app/functions/slice.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.slice = void 0; +exports.slice = (n) => (m) => (as) => Array.from(as).slice(n, m); diff --git a/dist/app/functions/sort.d.ts b/dist/app/functions/sort.d.ts new file mode 100644 index 00000000..34d1a8c2 --- /dev/null +++ b/dist/app/functions/sort.d.ts @@ -0,0 +1 @@ +export declare const sort: (compare: ((a1: A, a2: A) => number) | undefined) => (as: ArrayLike | Iterable) => A[]; diff --git a/dist/app/functions/sort.js b/dist/app/functions/sort.js new file mode 100644 index 00000000..fe524470 --- /dev/null +++ b/dist/app/functions/sort.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sort = void 0; +exports.sort = (compare) => (as) => Array.from(as).sort(compare); diff --git a/dist/app/functions/split.d.ts b/dist/app/functions/split.d.ts new file mode 100644 index 00000000..bddbec6e --- /dev/null +++ b/dist/app/functions/split.d.ts @@ -0,0 +1 @@ +export declare const split: (separator?: string | RegExp | undefined, limit?: number | undefined) => (source: string) => string[]; diff --git a/dist/app/functions/split.js b/dist/app/functions/split.js new file mode 100644 index 00000000..c3d1e2d2 --- /dev/null +++ b/dist/app/functions/split.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.split = void 0; +exports.split = (separator, limit) => (source) => separator == undefined + ? [source] + : separator === "" + ? Array.from(source).slice(0, limit) + : source.split(separator, limit); diff --git a/dist/app/functions/tail.d.ts b/dist/app/functions/tail.d.ts new file mode 100644 index 00000000..33eeb84c --- /dev/null +++ b/dist/app/functions/tail.d.ts @@ -0,0 +1 @@ +export declare const tail: ([, ...as]: readonly A[]) => A[]; diff --git a/dist/app/functions/tail.js b/dist/app/functions/tail.js new file mode 100644 index 00000000..b17eecf7 --- /dev/null +++ b/dist/app/functions/tail.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.tail = void 0; +exports.tail = ([, ...as]) => as; diff --git a/dist/app/functions/take.d.ts b/dist/app/functions/take.d.ts new file mode 100644 index 00000000..167d8dfd --- /dev/null +++ b/dist/app/functions/take.d.ts @@ -0,0 +1 @@ +export declare const take: (n: number) => (as: readonly A[]) => A[]; diff --git a/dist/app/functions/take.js b/dist/app/functions/take.js new file mode 100644 index 00000000..587b4bf7 --- /dev/null +++ b/dist/app/functions/take.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.take = void 0; +exports.take = (n) => (as) => as.slice(0, n); diff --git a/dist/app/functions/tap.d.ts b/dist/app/functions/tap.d.ts new file mode 100644 index 00000000..a9ad10a9 --- /dev/null +++ b/dist/app/functions/tap.d.ts @@ -0,0 +1 @@ +export declare const tap: (f: (a: A) => void) => (a: A) => A; diff --git a/dist/app/functions/tap.js b/dist/app/functions/tap.js new file mode 100644 index 00000000..e5242c7d --- /dev/null +++ b/dist/app/functions/tap.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.tap = void 0; +exports.tap = (f) => (a) => { + f(a); + return a; +}; diff --git a/dist/app/functions/toArray.d.ts b/dist/app/functions/toArray.d.ts new file mode 100644 index 00000000..c56d3711 --- /dev/null +++ b/dist/app/functions/toArray.d.ts @@ -0,0 +1 @@ +export declare const toArray: (as: Iterable | ArrayLike) => A[]; diff --git a/dist/app/functions/toArray.js b/dist/app/functions/toArray.js new file mode 100644 index 00000000..b67f7cbd --- /dev/null +++ b/dist/app/functions/toArray.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toArray = void 0; +exports.toArray = (as) => Array.from(as); diff --git a/dist/app/functions/toString.d.ts b/dist/app/functions/toString.d.ts new file mode 100644 index 00000000..2e15a0fe --- /dev/null +++ b/dist/app/functions/toString.d.ts @@ -0,0 +1 @@ +export declare const toString: (a: unknown) => string; diff --git a/dist/app/functions/toString.js b/dist/app/functions/toString.js new file mode 100644 index 00000000..19885b10 --- /dev/null +++ b/dist/app/functions/toString.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toString = void 0; +exports.toString = (a) => `${a}`; diff --git a/dist/app/functions/toUnary.d.ts b/dist/app/functions/toUnary.d.ts new file mode 100644 index 00000000..916b80b6 --- /dev/null +++ b/dist/app/functions/toUnary.d.ts @@ -0,0 +1 @@ +export declare function toUnary(v: (...as: AS) => B): (as: AS) => B; diff --git a/dist/app/functions/toUnary.js b/dist/app/functions/toUnary.js new file mode 100644 index 00000000..370b6b43 --- /dev/null +++ b/dist/app/functions/toUnary.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUnary = void 0; +function toUnary(v) { + return (as) => v(...as); +} +exports.toUnary = toUnary; diff --git a/dist/app/functions/toVariadic.d.ts b/dist/app/functions/toVariadic.d.ts new file mode 100644 index 00000000..6aa14e62 --- /dev/null +++ b/dist/app/functions/toVariadic.d.ts @@ -0,0 +1 @@ +export declare const toVariadic: (u: (as: AS) => B) => (...as: AS) => B; diff --git a/dist/app/functions/toVariadic.js b/dist/app/functions/toVariadic.js new file mode 100644 index 00000000..25a0da7a --- /dev/null +++ b/dist/app/functions/toVariadic.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toVariadic = void 0; +exports.toVariadic = (u) => (...as) => u(as); diff --git a/dist/app/functions/trim.d.ts b/dist/app/functions/trim.d.ts new file mode 100644 index 00000000..235f1321 --- /dev/null +++ b/dist/app/functions/trim.d.ts @@ -0,0 +1 @@ +export declare const trim: (s: string) => string; diff --git a/dist/app/functions/trim.js b/dist/app/functions/trim.js new file mode 100644 index 00000000..8e5d3101 --- /dev/null +++ b/dist/app/functions/trim.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.trim = void 0; +exports.trim = (s) => s.trim(); diff --git a/dist/app/functions/uncurry.d.ts b/dist/app/functions/uncurry.d.ts new file mode 100644 index 00000000..f5ea4530 --- /dev/null +++ b/dist/app/functions/uncurry.d.ts @@ -0,0 +1 @@ +export declare const uncurry: (length: number) => (curried: (a: A) => B) => (...allArguments: AS) => (a: A) => B; diff --git a/dist/app/functions/uncurry.js b/dist/app/functions/uncurry.js new file mode 100644 index 00000000..56adc651 --- /dev/null +++ b/dist/app/functions/uncurry.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.uncurry = void 0; +const applyArgument = (currentStep, a) => currentStep(a); +exports.uncurry = (length) => (curried) => (...allArguments) => { + const expectedArguments = allArguments.slice(0, length); + return expectedArguments.reduce(applyArgument, curried); +}; diff --git a/dist/app/functions/unless.d.ts b/dist/app/functions/unless.d.ts new file mode 100644 index 00000000..3f06253a --- /dev/null +++ b/dist/app/functions/unless.d.ts @@ -0,0 +1 @@ +export declare const unless: (p: (a: X) => a is A) => (mapXB: (x: X) => B) => (a: X) => A | B; diff --git a/dist/app/functions/unless.js b/dist/app/functions/unless.js new file mode 100644 index 00000000..f0f86ec7 --- /dev/null +++ b/dist/app/functions/unless.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unless = void 0; +exports.unless = (p) => (mapXB) => (a) => (p(a) ? a : mapXB(a)); diff --git a/dist/functions/F.d.ts b/dist/functions/F.d.ts deleted file mode 100644 index 9750d3d2..00000000 --- a/dist/functions/F.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * F :: * => false - * ``` - * ----------------------------------------------------------------------------- - * - * __F__ ignores any arguments passed to it and returns `false`. - * - */ -export declare const F: (...ignored: unknown[]) => false; diff --git a/dist/functions/F.js b/dist/functions/F.js deleted file mode 100644 index aa990c10..00000000 --- a/dist/functions/F.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.F = void 0; -/** - * ``` - * F :: * => false - * ``` - * ----------------------------------------------------------------------------- - * - * __F__ ignores any arguments passed to it and returns `false`. - * - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -exports.F = (...ignored) => false; diff --git a/dist/functions/T.d.ts b/dist/functions/T.d.ts deleted file mode 100644 index 3f23a6b4..00000000 --- a/dist/functions/T.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * T :: * => true - * ``` - * ----------------------------------------------------------------------------- - * - * __T__ ignores any arguments passed to it and returns `true`. - * - */ -export declare const T: (...ignored: unknown[]) => true; diff --git a/dist/functions/T.js b/dist/functions/T.js deleted file mode 100644 index 9971d46d..00000000 --- a/dist/functions/T.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.T = void 0; -/** - * ``` - * T :: * => true - * ``` - * ----------------------------------------------------------------------------- - * - * __T__ ignores any arguments passed to it and returns `true`. - * - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -exports.T = (...ignored) => true; diff --git a/dist/functions/always.d.ts b/dist/functions/always.d.ts deleted file mode 100644 index a8909b86..00000000 --- a/dist/functions/always.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * ``` - * always :: a => * => a - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a function that always returns _a_, ignoring any arguments. - */ -export declare const always: (a: A) => (...bs: unknown[]) => A; diff --git a/dist/functions/always.js b/dist/functions/always.js deleted file mode 100644 index 4cbb8ffa..00000000 --- a/dist/functions/always.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.always = void 0; -/** - * ``` - * always :: a => * => a - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a function that always returns _a_, ignoring any arguments. - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -exports.always = (a) => (...bs) => a; diff --git a/dist/functions/assoc.d.ts b/dist/functions/assoc.d.ts deleted file mode 100644 index 74ece3e5..00000000 --- a/dist/functions/assoc.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ``` - * assoc = k => b => a => {...a, k:b} - * ``` - * ----------------------------------------------------------------------------- - * - * Clones the object __a__, associating the key, __k__, with value, __b__. - * - * For example: - * - * ``` - * a[k] = b <=> assoc(k)(b)(a). - * ``` - * - */ -export declare const assoc: (k: K) => (b: B) => (a: A) => A | { - K: B; -}; diff --git a/dist/functions/assoc.js b/dist/functions/assoc.js deleted file mode 100644 index d8917198..00000000 --- a/dist/functions/assoc.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.assoc = void 0; -const functions_1 = require("../functions"); -/** - * ``` - * assoc = k => b => a => {...a, k:b} - * ``` - * ----------------------------------------------------------------------------- - * - * Clones the object __a__, associating the key, __k__, with value, __b__. - * - * For example: - * - * ``` - * a[k] = b <=> assoc(k)(b)(a). - * ``` - * - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -exports.assoc = (k) => (b) => (a) => Object.assign(functions_1.clone(a), { [k]: b }); diff --git a/dist/functions/bind.d.ts b/dist/functions/bind.d.ts deleted file mode 100644 index 0e541387..00000000 --- a/dist/functions/bind.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ``` - * bind :: (...as => b) => o => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * Creates a new _Function_ that binds a __method__ to a __context__. - * - * @param m - a function that depends on a dynamic `this` context - * @param o - the method's context - */ -export declare const bind: (m: M) => (b: ThisParameterType) => OmitThisParameter; diff --git a/dist/functions/bind.js b/dist/functions/bind.js deleted file mode 100644 index 39c13416..00000000 --- a/dist/functions/bind.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.bind = void 0; -/** - * ``` - * bind :: (...as => b) => o => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * Creates a new _Function_ that binds a __method__ to a __context__. - * - * @param m - a function that depends on a dynamic `this` context - * @param o - the method's context - */ -exports.bind = (m) => (b) => m.bind(b); diff --git a/dist/functions/blackbird.d.ts b/dist/functions/blackbird.d.ts deleted file mode 100644 index 1fa99d8b..00000000 --- a/dist/functions/blackbird.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * ``` - * blackbird :: ((b¹, b², ..., bⁿ) => c) => (a => b¹, a => b², ..., a => bⁿ) => a => c - * ``` - * ----------------------------------------------------------------------------- - * The __blackbird__ _Combinator_ takes a __converging__ _function_ that - * accepts _n_ arguments, _n_ _Unary_ function __parts__, and a __value__. It - * applies the value to each part, and computes a final result by applying - * the returned values as arguments to the __converging__ function. For example: - * - * ``` - * const sum = (...ns) => ns.reduce((a, b) => a + b, 0) - * const increment = a => a + 1 - * const square = a => a * a - * - * blackbird(sum)(increment, square)(3) - * //> sum(increment(3), square(3)) - * //> sum(3 + 1, 3 * 4) - * //> sum(4, 9) - * //> 0 + 4 + 9 - * //> 13 - * ``` - * - * @todo add support for Variadic Tuples in TypeScript 4 - */ -export declare const blackbird: (converging: (...bs: any[]) => C) => (...parts: ((a: A) => unknown)[]) => (a: A) => C; diff --git a/dist/functions/blackbird.js b/dist/functions/blackbird.js deleted file mode 100644 index 0d2e139c..00000000 --- a/dist/functions/blackbird.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.blackbird = void 0; -/** - * ``` - * blackbird :: ((b¹, b², ..., bⁿ) => c) => (a => b¹, a => b², ..., a => bⁿ) => a => c - * ``` - * ----------------------------------------------------------------------------- - * The __blackbird__ _Combinator_ takes a __converging__ _function_ that - * accepts _n_ arguments, _n_ _Unary_ function __parts__, and a __value__. It - * applies the value to each part, and computes a final result by applying - * the returned values as arguments to the __converging__ function. For example: - * - * ``` - * const sum = (...ns) => ns.reduce((a, b) => a + b, 0) - * const increment = a => a + 1 - * const square = a => a * a - * - * blackbird(sum)(increment, square)(3) - * //> sum(increment(3), square(3)) - * //> sum(3 + 1, 3 * 4) - * //> sum(4, 9) - * //> 0 + 4 + 9 - * //> 13 - * ``` - * - * @todo add support for Variadic Tuples in TypeScript 4 - */ -exports.blackbird = (converging) => (...parts) => (a) => { - const bs = parts.map((part) => part(a)); - return converging(...bs); -}; diff --git a/dist/functions/both.d.ts b/dist/functions/both.d.ts deleted file mode 100644 index 1e7a7b9a..00000000 --- a/dist/functions/both.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * both :: (a => b) => (a => c) => a => b|c - * ``` - * ----------------------------------------------------------------------------- - * Returns the result of calling the first Predicate if `mapAB(a) == false`, - * otherwise returns `mapAC(a)`. - * - */ -export declare const both: (first: (a: A) => B) => (second: (a: A) => C) => (a: A) => B | C; diff --git a/dist/functions/both.js b/dist/functions/both.js deleted file mode 100644 index 3d6f2999..00000000 --- a/dist/functions/both.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.both = void 0; -/** - * ``` - * both :: (a => b) => (a => c) => a => b|c - * ``` - * ----------------------------------------------------------------------------- - * Returns the result of calling the first Predicate if `mapAB(a) == false`, - * otherwise returns `mapAC(a)`. - * - */ -exports.both = (first) => (second) => (a) => first(a) && second(a); diff --git a/dist/functions/cap.d.ts b/dist/functions/cap.d.ts deleted file mode 100644 index cfe2d091..00000000 --- a/dist/functions/cap.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ``` - * cap :: s => s - * ``` - * @param {string} word word we want to capitalize - */ -export declare const cap: (word: string) => string; diff --git a/dist/functions/clone.d.ts b/dist/functions/clone.d.ts deleted file mode 100644 index 789b4c19..00000000 --- a/dist/functions/clone.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * clone :: a => a - * ``` - * @export - * @template A - * @param {A} a - * @returns {A} - */ -export declare function clone(a: A): A; diff --git a/dist/functions/complement.d.ts b/dist/functions/complement.d.ts deleted file mode 100644 index 564e31b7..00000000 --- a/dist/functions/complement.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ``` - * complement :: (a => Boolean) => a => Boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a function that will return the _complement_ of applying a _value_ - * to the given _predicate_. For example: - * - * ``` - * const isFunction = f => typeof f === 'function - * const isNotFunction = complement(f) - * - * isFunction('value') => false - * isNotFunction('value') => true - * ``` - */ -export declare const complement: (predicate: (a: A) => boolean) => (a: A) => boolean; diff --git a/dist/functions/complement.js b/dist/functions/complement.js deleted file mode 100644 index a3416a3f..00000000 --- a/dist/functions/complement.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.complement = void 0; -/** - * ``` - * complement :: (a => Boolean) => a => Boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a function that will return the _complement_ of applying a _value_ - * to the given _predicate_. For example: - * - * ``` - * const isFunction = f => typeof f === 'function - * const isNotFunction = complement(f) - * - * isFunction('value') => false - * isNotFunction('value') => true - * ``` - */ -exports.complement = (predicate) => (a) => !predicate(a); diff --git a/dist/functions/compose.d.ts b/dist/functions/compose.d.ts deleted file mode 100644 index 1b82d7f2..00000000 --- a/dist/functions/compose.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Compose, Last } from "../types"; -/** - * ``` - * compose :: (aⁿ⁻¹ => aⁿ, ..., a¹ => a², a⁰ => a¹) => a⁰ => aⁿ - * ``` - * - * Takes any number, _n_, unary Functions of the form `aˣ⁻¹ => aˣ`, and composes - * them in a right-to-left order, passing the value, _a⁰_, to the right-most - * function, the return value, _a¹_ to the next-right-most function, etc. - * finally returning _aⁿ_. For example: - * - * ``` - * compose(h, g, f)(a) <=> h(g(f(a))) - * ``` - * - * ## Warning - * - * While _compose(...)_ can correctly detect the types of _a⁰_ and _aⁿ_, it - * cannot detect if the return type for an inner function fails to satisfy the - * type requirements for the next function. In the above example, the TypeScript - * Compiler will not consider it an error if _f_ returns a `number`, but _g_ - * accepts only a `string`. - * - * To guarantee type safety, use the _fluent_ API: - * - * ``` - * compose.fluent(h).then(g).then(f).invoke(a) <=> h(g(f(a))) - * ``` - * - * The fluent algorithm guarantees that the return type of _f_ will match the - * argument type of _g_, that _g_ will match _h_, etc. Note that the final - * `invoke` method is equivalent to: - * - * ``` - * compose.fluent(h).then(g).then(f)(a) - * ``` - * and if you assign a fluent chain to a variable you may treat it as a normal - * function. For example: - * ``` - * const hgf = compose.fluent(h).then(g).then(f) - * hgf(a) <=> hgf.invoke(a) - * ``` - - * - * - * ``` - * ``` - */ -export declare const compose: ( any)[]>(...fs: FS) => (a: Parameters>[0]) => ReturnType) & { - fluent: (f: (b: B) => A) => Compose; -}; diff --git a/dist/functions/compose.js b/dist/functions/compose.js deleted file mode 100644 index b510715a..00000000 --- a/dist/functions/compose.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.compose = void 0; -const fluent = (f) => { - function call(b) { - return f(b); - } - const p = Object.assign(call.bind(null), { - from: (f) => { - return after(p, f); - }, - call, - }); - return p; -}; -const after = (next, f) => { - function call(c) { - return next(f(c)); - } - const p = Object.assign(call.bind(null), { - from: (f) => { - return after(p, f); - }, - call, - }); - return p; -}; -/** - * ``` - * compose :: (aⁿ⁻¹ => aⁿ, ..., a¹ => a², a⁰ => a¹) => a⁰ => aⁿ - * ``` - * - * Takes any number, _n_, unary Functions of the form `aˣ⁻¹ => aˣ`, and composes - * them in a right-to-left order, passing the value, _a⁰_, to the right-most - * function, the return value, _a¹_ to the next-right-most function, etc. - * finally returning _aⁿ_. For example: - * - * ``` - * compose(h, g, f)(a) <=> h(g(f(a))) - * ``` - * - * ## Warning - * - * While _compose(...)_ can correctly detect the types of _a⁰_ and _aⁿ_, it - * cannot detect if the return type for an inner function fails to satisfy the - * type requirements for the next function. In the above example, the TypeScript - * Compiler will not consider it an error if _f_ returns a `number`, but _g_ - * accepts only a `string`. - * - * To guarantee type safety, use the _fluent_ API: - * - * ``` - * compose.fluent(h).then(g).then(f).invoke(a) <=> h(g(f(a))) - * ``` - * - * The fluent algorithm guarantees that the return type of _f_ will match the - * argument type of _g_, that _g_ will match _h_, etc. Note that the final - * `invoke` method is equivalent to: - * - * ``` - * compose.fluent(h).then(g).then(f)(a) - * ``` - * and if you assign a fluent chain to a variable you may treat it as a normal - * function. For example: - * ``` - * const hgf = compose.fluent(h).then(g).then(f) - * hgf(a) <=> hgf.invoke(a) - * ``` - - * - * - * ``` - * ``` - */ -exports.compose = Object.assign( -// eslint-disable-next-line @typescript-eslint/no-explicit-any -(...fs) => { - return (a) => fs.reduceRight((v, f) => f(v), a); -}, { fluent }); diff --git a/dist/functions/concat.d.ts b/dist/functions/concat.d.ts deleted file mode 100644 index c9fa0426..00000000 --- a/dist/functions/concat.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * ``` - * concat :: as => bs => [...as,...bs] - * ``` - * ----------------------------------------------------------------------------- - * - * Concatenates two iterable objects. - * - * ``` - * const as = [0, 1, 2] - * const bs = [3, 4] - * concat(as)(bs) <=> [...as, ...bs] - * ``` - * - * Or with variadic types: - * ``` - * const as = ["a", 1, { foo: "bar" } ] - * const bs = ["b", { bar: "baz" } ] - * concat(as)(bs) <=> ["a", 1, { foo: "bar" }, "b", { bar: "baz" } ] - * ``` - */ -export declare const concat: (as: A) => (bs: B) => [...A, ...B]; diff --git a/dist/functions/concat.js b/dist/functions/concat.js deleted file mode 100644 index 7ce2cfd6..00000000 --- a/dist/functions/concat.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.concat = void 0; -/** - * ``` - * concat :: as => bs => [...as,...bs] - * ``` - * ----------------------------------------------------------------------------- - * - * Concatenates two iterable objects. - * - * ``` - * const as = [0, 1, 2] - * const bs = [3, 4] - * concat(as)(bs) <=> [...as, ...bs] - * ``` - * - * Or with variadic types: - * ``` - * const as = ["a", 1, { foo: "bar" } ] - * const bs = ["b", { bar: "baz" } ] - * concat(as)(bs) <=> ["a", 1, { foo: "bar" }, "b", { bar: "baz" } ] - * ``` - */ -exports.concat = (as // -) => (bs // -) => [...as, ...bs]; diff --git a/dist/functions/curry.d.ts b/dist/functions/curry.d.ts deleted file mode 100644 index dd96264e..00000000 --- a/dist/functions/curry.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * ``` - * curry :: ((a¹, a²..., aⁿ) => b) => a¹ => a²... => aⁿ => b - * ``` - * ----------------------------------------------------------------------------- - * Converts a _Variadic_ function into a series of _Unary_ functions that - * produce the same final value. - * - * @todo add support for Variadic Tuples in TypeScript 4 - * - */ -export declare const curry: (f: F) => (...as: unknown[]) => any; diff --git a/dist/functions/curry.js b/dist/functions/curry.js deleted file mode 100644 index bcdd3dc6..00000000 --- a/dist/functions/curry.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.curry = void 0; -const functions_1 = require("../functions"); -/** - * ``` - * curry :: ((a¹, a²..., aⁿ) => b) => a¹ => a²... => aⁿ => b - * ``` - * ----------------------------------------------------------------------------- - * Converts a _Variadic_ function into a series of _Unary_ functions that - * produce the same final value. - * - * @todo add support for Variadic Tuples in TypeScript 4 - * - */ -exports.curry = (f) => functions_1.curryN(f.length)(f); diff --git a/dist/functions/curryN.d.ts b/dist/functions/curryN.d.ts deleted file mode 100644 index ea284dbe..00000000 --- a/dist/functions/curryN.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ``` - * curryN :: n => ((a¹, a², ..., aⁿ) => b) => a¹ => a²... => aⁿ => b - * ``` - * ----------------------------------------------------------------------------- - * Converts a function that accepts an arity, __n__, number of arguments into a - * series of _Unary_ functions that produce the same final value. - * - * @todo add support for Variadic Tuples in TypeScript 4 - */ -export declare const curryN: (n: number) => (f: F) => (...as: unknown[]) => any; diff --git a/dist/functions/defaultTo.d.ts b/dist/functions/defaultTo.d.ts deleted file mode 100644 index a867acf0..00000000 --- a/dist/functions/defaultTo.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * defaultTo :: a => b => a|b - * ``` - * ----------------------------------------------------------------------------- - * - * If __b__ is `null`, `undefined`, or `NaN`, return __a__, otherwise return __b__. - * - */ -export declare const defaultTo: (a: A) => (b: B) => A | B; diff --git a/dist/functions/defaultTo.js b/dist/functions/defaultTo.js deleted file mode 100644 index c11d4801..00000000 --- a/dist/functions/defaultTo.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultTo = void 0; -const functions_1 = require("../functions"); -/** - * ``` - * defaultTo :: a => b => a|b - * ``` - * ----------------------------------------------------------------------------- - * - * If __b__ is `null`, `undefined`, or `NaN`, return __a__, otherwise return __b__. - * - */ -exports.defaultTo = (a) => (b) => functions_1.isNaN(b) ? a : functions_1.isDefined(b) ? b : a; diff --git a/dist/functions/either.d.ts b/dist/functions/either.d.ts deleted file mode 100644 index 80bc46f7..00000000 --- a/dist/functions/either.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * ``` - * either :: (a => b) => (a => c) => a|c - * ``` - * ----------------------------------------------------------------------------- - * - * The __either__ combinator creates a _Unary_ from two functions. It returns - * __b__ from calling `mapAB(a)` if __b__ is truthy. Otherwise, it returns __c__ - * from calling `mapAC(a)`. - * - */ -export declare const either: (mapAB: (a: A) => B) => (mapAC: (a: A) => C) => (a: A) => B | C; diff --git a/dist/functions/either.js b/dist/functions/either.js deleted file mode 100644 index b5c4f0c1..00000000 --- a/dist/functions/either.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.either = void 0; -/** - * ``` - * either :: (a => b) => (a => c) => a|c - * ``` - * ----------------------------------------------------------------------------- - * - * The __either__ combinator creates a _Unary_ from two functions. It returns - * __b__ from calling `mapAB(a)` if __b__ is truthy. Otherwise, it returns __c__ - * from calling `mapAC(a)`. - * - */ -exports.either = (mapAB) => (mapAC) => (a) => mapAB(a) || mapAC(a); diff --git a/dist/functions/equals.d.ts b/dist/functions/equals.d.ts deleted file mode 100644 index d0e3bf8b..00000000 --- a/dist/functions/equals.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * ``` - * equals :: a => b => Boolean - * ``` - * ----------------------------------------------------------------------------- - * - * __equals__ creates a _Predicate_ that compares the argument, __a__, to the - * argument, __b__, using the strict-equality operator, i.e.: - * - * ``` - * equals(a, b) <=> a === b - * ``` - * - */ -export declare const equals: (a: unknown) => (b: unknown) => boolean; diff --git a/dist/functions/equals.js b/dist/functions/equals.js deleted file mode 100644 index 95b1e699..00000000 --- a/dist/functions/equals.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.equals = void 0; -/** - * ``` - * equals :: a => b => Boolean - * ``` - * ----------------------------------------------------------------------------- - * - * __equals__ creates a _Predicate_ that compares the argument, __a__, to the - * argument, __b__, using the strict-equality operator, i.e.: - * - * ``` - * equals(a, b) <=> a === b - * ``` - * - */ -exports.equals = (a) => (b) => a === b; diff --git a/dist/functions/filter.d.ts b/dist/functions/filter.d.ts deleted file mode 100644 index a748eb9a..00000000 --- a/dist/functions/filter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * filter :: (a => Boolean) => as => as - * ``` - * ----------------------------------------------------------------------------- - * Filters a list, keeping only the values for which the __predicate__ returns - * _true_. - * - */ -export declare const filter: (p: (a: A) => boolean) => (as: A[]) => A[]; diff --git a/dist/functions/filter.js b/dist/functions/filter.js deleted file mode 100644 index ff07a07c..00000000 --- a/dist/functions/filter.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.filter = void 0; -/** - * ``` - * filter :: (a => Boolean) => as => as - * ``` - * ----------------------------------------------------------------------------- - * Filters a list, keeping only the values for which the __predicate__ returns - * _true_. - * - */ -exports.filter = (p) => (as) => as.filter(p); diff --git a/dist/functions/has.d.ts b/dist/functions/has.d.ts deleted file mode 100644 index d10b5bf6..00000000 --- a/dist/functions/has.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -declare type A = { - [P in PropertyName]: unknown; -}; -/** - * ``` - * has :: k => a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a _Predicate_ that returns `true` if it's argument has an owned - * property, __k__, otherwise returns `false`. Unlike the `in` operator, `has` - * will not check the prototype chain. For example: - * - * ``` - * 'toString' in {} //=> true - * has('toString', {}) //=> false - * ``` - * - * @param {string|symbol|number} k the name or symbol of the property to check for - * @param {unknown} a the object to check for ownership of the property - */ -export declare const has: (k: PropertyKey_1) => (a: unknown) => a is A; -export {}; diff --git a/dist/functions/has.js b/dist/functions/has.js deleted file mode 100644 index a76b13dd..00000000 --- a/dist/functions/has.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.has = void 0; -/** - * ``` - * has :: k => a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Creates a _Predicate_ that returns `true` if it's argument has an owned - * property, __k__, otherwise returns `false`. Unlike the `in` operator, `has` - * will not check the prototype chain. For example: - * - * ``` - * 'toString' in {} //=> true - * has('toString', {}) //=> false - * ``` - * - * @param {string|symbol|number} k the name or symbol of the property to check for - * @param {unknown} a the object to check for ownership of the property - */ -exports.has = (k) => (a) => Object.prototype.hasOwnProperty.call(a, k); diff --git a/dist/functions/head.d.ts b/dist/functions/head.d.ts deleted file mode 100644 index e409d98b..00000000 --- a/dist/functions/head.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * head :: as => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the first element of an array. - * - */ -export declare const head: (as: A[]) => A; diff --git a/dist/functions/head.js b/dist/functions/head.js deleted file mode 100644 index 2af81991..00000000 --- a/dist/functions/head.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.head = void 0; -/** - * ``` - * head :: as => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the first element of an array. - * - */ -exports.head = (as) => as[0]; diff --git a/dist/functions/identity.d.ts b/dist/functions/identity.d.ts deleted file mode 100644 index c790ab5f..00000000 --- a/dist/functions/identity.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * identity :: a => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns it's argument, unmodified. - * - */ -export declare const identity: (a: A) => A; diff --git a/dist/functions/identity.js b/dist/functions/identity.js deleted file mode 100644 index 09f1e8cb..00000000 --- a/dist/functions/identity.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.identity = void 0; -/** - * ``` - * identity :: a => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns it's argument, unmodified. - * - */ -exports.identity = (a) => a; diff --git a/dist/functions/iife.d.ts b/dist/functions/iife.d.ts deleted file mode 100644 index bc37645f..00000000 --- a/dist/functions/iife.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * iife :: (...as => b, ...as) => b - * ``` - * ----------------------------------------------------------------------------- - * Immediately Invokes a function, passing in the supplied parameters and - * returning the result, if any. - * - */ -export declare const iife: (f: (...as: AS) => B, ...as: AS) => B; diff --git a/dist/functions/iife.js b/dist/functions/iife.js deleted file mode 100644 index 29cf027b..00000000 --- a/dist/functions/iife.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.iife = void 0; -/** - * ``` - * iife :: (...as => b, ...as) => b - * ``` - * ----------------------------------------------------------------------------- - * Immediately Invokes a function, passing in the supplied parameters and - * returning the result, if any. - * - */ -exports.iife = (f, ...as) => f(...as); diff --git a/dist/functions/init.d.ts b/dist/functions/init.d.ts deleted file mode 100644 index 70399fa2..00000000 --- a/dist/functions/init.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * init :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns all but the last element in an array. - * - */ -export declare const init: (as: A[]) => A[]; diff --git a/dist/functions/init.js b/dist/functions/init.js deleted file mode 100644 index 869add53..00000000 --- a/dist/functions/init.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.init = void 0; -/** - * ``` - * init :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns all but the last element in an array. - * - */ -exports.init = (as) => as.slice(0, as.length - 1); diff --git a/dist/functions/invoker.d.ts b/dist/functions/invoker.d.ts deleted file mode 100644 index 25b8c427..00000000 --- a/dist/functions/invoker.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * type `A` ensures that our object contains the property PropertyName - */ -declare type Invokable = { - [P in PropertyName]: F; -}; -/** - * ``` - * invoker :: k => (...as) => (b.k => c) => c - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a method name, __k__; one or more arguments, __as__; and an object, - * __b__, which has a method of name __k__. It invokes the method, applying - * __as__ as arguments, and returns the result, __c__; i.e.: - * - * ``` - * invoker(k, ...as, b) <=> b[k](...as) <=> - * ``` - * @todo Add support for Variadic Tuples when TypeScript 4 is released. - */ -export declare const invoker: (propertyKey: PropertyKey_1) => (...args: A[]) => (a: Invokable) => F; -export {}; diff --git a/dist/functions/invoker.js b/dist/functions/invoker.js deleted file mode 100644 index 864b3e8e..00000000 --- a/dist/functions/invoker.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.invoker = void 0; -/** - * ``` - * invoker :: k => (...as) => (b.k => c) => c - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a method name, __k__; one or more arguments, __as__; and an object, - * __b__, which has a method of name __k__. It invokes the method, applying - * __as__ as arguments, and returns the result, __c__; i.e.: - * - * ``` - * invoker(k, ...as, b) <=> b[k](...as) <=> - * ``` - * @todo Add support for Variadic Tuples when TypeScript 4 is released. - */ -exports.invoker = (propertyKey) => (...args) => (a) => a[propertyKey](...args); diff --git a/dist/functions/isArray.d.ts b/dist/functions/isArray.d.ts deleted file mode 100644 index 2605a95f..00000000 --- a/dist/functions/isArray.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * isDefined :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `false` if a is `undefined` or `null`, otherwise return `true`. - * - */ -export declare const isArray: (arg: any) => arg is any[]; diff --git a/dist/functions/isArray.js b/dist/functions/isArray.js deleted file mode 100644 index 1338cc26..00000000 --- a/dist/functions/isArray.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isArray = void 0; -/** - * ``` - * isDefined :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `false` if a is `undefined` or `null`, otherwise return `true`. - * - */ -exports.isArray = Array.isArray; diff --git a/dist/functions/isDate.d.ts b/dist/functions/isDate.d.ts deleted file mode 100644 index 9ae6cc86..00000000 --- a/dist/functions/isDate.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * isDate :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if a is a Date object, `false` otherwise. - * - */ -export declare const isDate: (a: unknown) => a is Date; diff --git a/dist/functions/isDate.js b/dist/functions/isDate.js deleted file mode 100644 index 0b6f44bf..00000000 --- a/dist/functions/isDate.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isDate = void 0; -/** - * ``` - * isDate :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if a is a Date object, `false` otherwise. - * - */ -exports.isDate = (a) => a instanceof Date; diff --git a/dist/functions/isDefined.d.ts b/dist/functions/isDefined.d.ts deleted file mode 100644 index 194cd3e9..00000000 --- a/dist/functions/isDefined.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * isDefined :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `false` if a is `undefined` or `null`, otherwise return `true`. - * - */ -export declare const isDefined: (a: A) => a is Exclude & Exclude; diff --git a/dist/functions/isDefined.js b/dist/functions/isDefined.js deleted file mode 100644 index 31d4f90e..00000000 --- a/dist/functions/isDefined.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isDefined = void 0; -/** - * ``` - * isDefined :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `false` if a is `undefined` or `null`, otherwise return `true`. - * - */ -exports.isDefined = (a) => a != null; diff --git a/dist/functions/isEmpty.d.ts b/dist/functions/isEmpty.d.ts deleted file mode 100644 index 7e89be3c..00000000 --- a/dist/functions/isEmpty.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * ``` - * isEmpty :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is an empty value for it's type, - * `false` otherwise. For example: - * - * ``` - * isEmpty("") //> true - * isEmpty([]) //> true - * isEmpty({}) //> true - * isEmpty(0) //> false - * ``` - */ -export declare const isEmpty: (a: unknown) => boolean; diff --git a/dist/functions/isEmpty.js b/dist/functions/isEmpty.js deleted file mode 100644 index 8da6d662..00000000 --- a/dist/functions/isEmpty.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEmpty = void 0; -/** - * ``` - * isEmpty :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is an empty value for it's type, - * `false` otherwise. For example: - * - * ``` - * isEmpty("") //> true - * isEmpty([]) //> true - * isEmpty({}) //> true - * isEmpty(0) //> false - * ``` - */ -exports.isEmpty = (a) => (Array.isArray(a) && a.length === 0) || - (typeof a === "string" && a.length === 0) || - (typeof a === "object" && a !== null && Object.keys(a).length === 0); diff --git a/dist/functions/isFunction.d.ts b/dist/functions/isFunction.d.ts deleted file mode 100644 index 23029c16..00000000 --- a/dist/functions/isFunction.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ``` - * isFunction :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is callable, `false` otherwise. - * For example: - * - * ``` - * isFunction(function() {}) //> true - * isFunction(() => 'function') //> true - * const object = { method() {} } - * isFunction(object) //> false - * isFUnction(object.method) //> true - * isFUnction(object.method()) //> false - * ``` - */ -export declare const isFunction: (a: unknown) => a is Function; diff --git a/dist/functions/isFunction.js b/dist/functions/isFunction.js deleted file mode 100644 index 0ca36184..00000000 --- a/dist/functions/isFunction.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isFunction = void 0; -/** - * ``` - * isFunction :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is callable, `false` otherwise. - * For example: - * - * ``` - * isFunction(function() {}) //> true - * isFunction(() => 'function') //> true - * const object = { method() {} } - * isFunction(object) //> false - * isFUnction(object.method) //> true - * isFUnction(object.method()) //> false - * ``` - */ -exports.isFunction = (a) => typeof a === "function"; diff --git a/dist/functions/isNaN.d.ts b/dist/functions/isNaN.d.ts deleted file mode 100644 index 8b45650c..00000000 --- a/dist/functions/isNaN.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * ``` - * isNaN :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is the number `NaN`, `false` - * otherwise. - */ -export declare const isNaN: (a: unknown) => a is number; diff --git a/dist/functions/isNaN.js b/dist/functions/isNaN.js deleted file mode 100644 index cee38b04..00000000 --- a/dist/functions/isNaN.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isNaN = void 0; -/** - * ``` - * isNaN :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is the number `NaN`, `false` - * otherwise. - */ -exports.isNaN = (a) => Number.isNaN(a); diff --git a/dist/functions/isNil.d.ts b/dist/functions/isNil.d.ts deleted file mode 100644 index 3584d8e5..00000000 --- a/dist/functions/isNil.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * ``` - * isNil :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is `null` or `undefined`, - * `false` otherwise. For example - * - * ``` - * isNil(null) => true - * isNil(undefined) => true - * isNil(0) => false - * ``` - */ -export declare const isNil: (a: unknown) => a is null | undefined; diff --git a/dist/functions/isNil.js b/dist/functions/isNil.js deleted file mode 100644 index d3708a0d..00000000 --- a/dist/functions/isNil.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isNil = void 0; -/** - * ``` - * isNil :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is `null` or `undefined`, - * `false` otherwise. For example - * - * ``` - * isNil(null) => true - * isNil(undefined) => true - * isNil(0) => false - * ``` - */ -exports.isNil = (a) => a === null || a === undefined; diff --git a/dist/functions/isNumber.d.ts b/dist/functions/isNumber.d.ts deleted file mode 100644 index dd8ffcb5..00000000 --- a/dist/functions/isNumber.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * isNumber :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if __a__ has type `number`. - * - */ -export declare const isNumber: (a: unknown) => a is number; diff --git a/dist/functions/isNumber.js b/dist/functions/isNumber.js deleted file mode 100644 index a9b001b1..00000000 --- a/dist/functions/isNumber.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isNumber = void 0; -/** - * ``` - * isNumber :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if __a__ has type `number`. - * - */ -exports.isNumber = (a) => typeof a === "number"; diff --git a/dist/functions/isObject.d.ts b/dist/functions/isObject.d.ts deleted file mode 100644 index 67272be0..00000000 --- a/dist/functions/isObject.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ``` - * isObject :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is callable, `false` otherwise. - * For example: - * - * ``` - * isObject(function() {}) //> true - * isObject(() => 'function') //> true - * const object = { method() {} } - * isObject(object) //> false - * isObject(object.method) //> true - * isObject(object.method()) //> false - * ``` - */ -export declare const isObject: (a: unknown) => a is object; diff --git a/dist/functions/isObject.js b/dist/functions/isObject.js deleted file mode 100644 index febdcc3e..00000000 --- a/dist/functions/isObject.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isObject = void 0; -/** - * ``` - * isObject :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * _Predicate_ that returns `true` if __a__ is callable, `false` otherwise. - * For example: - * - * ``` - * isObject(function() {}) //> true - * isObject(() => 'function') //> true - * const object = { method() {} } - * isObject(object) //> false - * isObject(object.method) //> true - * isObject(object.method()) //> false - * ``` - */ -exports.isObject = (a) => typeof a === "object"; diff --git a/dist/functions/isString.d.ts b/dist/functions/isString.d.ts deleted file mode 100644 index 0237184c..00000000 --- a/dist/functions/isString.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * isString :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if __a__ is a `string`, false otherwise. - * - */ -export declare const isString: (a: unknown) => a is string; diff --git a/dist/functions/isString.js b/dist/functions/isString.js deleted file mode 100644 index fb56df85..00000000 --- a/dist/functions/isString.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isString = void 0; -/** - * ``` - * isString :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Returns `true` if __a__ is a `string`, false otherwise. - * - */ -exports.isString = (a) => typeof a === "string"; diff --git a/dist/functions/join.d.ts b/dist/functions/join.d.ts deleted file mode 100644 index d9c50eb6..00000000 --- a/dist/functions/join.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * ``` - * join:: a => bs => a - * ``` - * ----------------------------------------------------------------------------- - * - * __join__ takes an optional separator string, __a__, an array, __bs__ of any - * type and returns a new string by concatenating all of the elements in the - * array, converting them to strings if necessary, and separating each element - * by either a comma, `","`, or __a__. - * - * If the array has only one item, then that item will be returned without using - * the separator. - * - * ``` - * [1, 2, 3].join("---") <=> join("---")([1, 2, 3]) <=> "1---2---3" - * [1, 2, 3].join() <=> join()([1, 2, 3]) <=> "1,2,3" - * ``` - */ -export declare const join: (a: string | undefined) => (bs: A[]) => string; diff --git a/dist/functions/join.js b/dist/functions/join.js deleted file mode 100644 index 5f527f56..00000000 --- a/dist/functions/join.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.join = void 0; -/** - * ``` - * join:: a => bs => a - * ``` - * ----------------------------------------------------------------------------- - * - * __join__ takes an optional separator string, __a__, an array, __bs__ of any - * type and returns a new string by concatenating all of the elements in the - * array, converting them to strings if necessary, and separating each element - * by either a comma, `","`, or __a__. - * - * If the array has only one item, then that item will be returned without using - * the separator. - * - * ``` - * [1, 2, 3].join("---") <=> join("---")([1, 2, 3]) <=> "1---2---3" - * [1, 2, 3].join() <=> join()([1, 2, 3]) <=> "1,2,3" - * ``` - */ -exports.join = (a) => (bs) => bs.join(a); diff --git a/dist/functions/last.d.ts b/dist/functions/last.d.ts deleted file mode 100644 index 4fd00fc1..00000000 --- a/dist/functions/last.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * last :: as => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the last element in an array. - * - */ -export declare const last: (as: A[]) => A; diff --git a/dist/functions/last.js b/dist/functions/last.js deleted file mode 100644 index 71db3a82..00000000 --- a/dist/functions/last.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.last = void 0; -/** - * ``` - * last :: as => a - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the last element in an array. - * - */ -exports.last = (as) => as[as.length - 1]; diff --git a/dist/functions/log.d.ts b/dist/functions/log.d.ts deleted file mode 100644 index ca31257f..00000000 --- a/dist/functions/log.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * ``` - * log :: s -> a -> a - * ``` - * ----------------------------------------------------------------------------- - * Takes a string, a _value_, logs the string and the value, and then returns - * the _value_. - */ -export declare const log: (s: string) => (a: A) => A; diff --git a/dist/functions/log.js b/dist/functions/log.js deleted file mode 100644 index 95a3152e..00000000 --- a/dist/functions/log.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.log = void 0; -/* global console */ -/** - * ``` - * log :: s -> a -> a - * ``` - * ----------------------------------------------------------------------------- - * Takes a string, a _value_, logs the string and the value, and then returns - * the _value_. - */ -exports.log = (s) => (a) => { - console.groupCollapsed(s); - console.log(a); - console.groupEnd(); - return a; -}; diff --git a/dist/functions/merge.d.ts b/dist/functions/merge.d.ts deleted file mode 100644 index d7caf548..00000000 --- a/dist/functions/merge.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * merge :: a => b => c - * ``` - * ----------------------------------------------------------------------------- - * - * Performs a shallow merge of two objects. - * - */ -export declare const merge: (a: A) => (b: B) => A & B; diff --git a/dist/functions/merge.js b/dist/functions/merge.js deleted file mode 100644 index 774b3e73..00000000 --- a/dist/functions/merge.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.merge = void 0; -/** - * ``` - * merge :: a => b => c - * ``` - * ----------------------------------------------------------------------------- - * - * Performs a shallow merge of two objects. - * - */ -exports.merge = (a) => (b) => Object.assign({}, a, b); diff --git a/dist/functions/not.d.ts b/dist/functions/not.d.ts deleted file mode 100644 index 0be7be8d..00000000 --- a/dist/functions/not.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * ``` - * not :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _value_, __a__, and returns it's [logical not][1]. - * - * ``` - * not('foo') <=> !'foo' <=> false - * ``` - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT_(!) - * - */ -export declare const not: (a: unknown) => boolean; diff --git a/dist/functions/not.js b/dist/functions/not.js deleted file mode 100644 index dc4e9d0f..00000000 --- a/dist/functions/not.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.not = void 0; -/** - * ``` - * not :: a => boolean - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _value_, __a__, and returns it's [logical not][1]. - * - * ``` - * not('foo') <=> !'foo' <=> false - * ``` - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT_(!) - * - */ -exports.not = (a) => !a; diff --git a/dist/functions/partial.d.ts b/dist/functions/partial.d.ts deleted file mode 100644 index 513a771d..00000000 --- a/dist/functions/partial.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ``` - * partial :: (a¹, …, aᵐ) => ((a¹, …, aⁿ, b¹, …, bⁿ) => c) => (b¹, …, bⁿ) => c - * ``` - * ----------------------------------------------------------------------------- - * - * Accepts _m_-number of arguments, **a**. Then accepts a function, **f**, of - * the form `(a¹, …, aⁿ, b¹, …, bⁿ) => c`. Then accepts the remaining _n_-number - * of arguments, __b__, and applies them to __f__, as in - * `f(a¹, …, aⁿ, b¹, …, bⁿ) => c`. - */ -export declare const partial: (...as: AS) => (f: (...args_0: AS, ...args_1: BS) => C) => (...bs: BS) => C; -export declare type Args = readonly unknown[]; diff --git a/dist/functions/partial.js b/dist/functions/partial.js deleted file mode 100644 index 562f94c8..00000000 --- a/dist/functions/partial.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.partial = void 0; -/** - * ``` - * partial :: (a¹, …, aᵐ) => ((a¹, …, aⁿ, b¹, …, bⁿ) => c) => (b¹, …, bⁿ) => c - * ``` - * ----------------------------------------------------------------------------- - * - * Accepts _m_-number of arguments, **a**. Then accepts a function, **f**, of - * the form `(a¹, …, aⁿ, b¹, …, bⁿ) => c`. Then accepts the remaining _n_-number - * of arguments, __b__, and applies them to __f__, as in - * `f(a¹, …, aⁿ, b¹, …, bⁿ) => c`. - */ -exports.partial = (...as) => (f) => (...bs) => f(...as, ...bs); diff --git a/dist/functions/pipe.d.ts b/dist/functions/pipe.d.ts deleted file mode 100644 index 885ab07c..00000000 --- a/dist/functions/pipe.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Last, Pipe } from "../types"; -/** - * ``` - * pipe :: (a⁰ => a¹, ..., aⁿ⁻¹ -> aⁿ) => a⁰ => aⁿ - * ``` - * - * Takes any number, _n_, unary Functions of the form `aˣ => aˣ⁺¹`, and composes - * them in a left-to-right order, passing the value, _a⁰_, to the left-most - * function, the return value, _a¹_ to the next-left-most function, etc., - * finally returning _aⁿ_. For example: - * - * ``` - * pipe(f, g, h)(a) <=> h(g(f(a))) - * ``` - * - * ## Warning - * - * While _pipe(...)_ can correctly detect the types of _a⁰_ and _aⁿ_, it cannot - * detect if the return type for an inner function fails to satisfy the type - * requirements for the next function. In the above example, the TypeScript - * Compiler will not consider it an error if _f_ returns a `number`, but _g_ - * accepts only a `string`. - * - * To guarantee type safety, use the _fluent_ API: - * - * ``` - * pipe.fluent(f).then(g).then(h).invoke(a) <=> h(g(f(a))) - * ``` - * - * The fluent algorithm guarantees that the return type of _f_ will match the - * argument type of _g_, that _g_ will match _h_, etc. Note that the final - * `invoke` method is equivalent to: - * - * ``` - * pipe.fluent(f).then(g).then(h)(a) - * ``` - * and if you assign a fluent chain to a variable you may treat it as a normal - * function. For example: - * ``` - * const fgh = pipe.fluent(f).then(g).then(h) - * fgh(a) <=> fgh.invoke(a) - * ``` - */ -export declare const pipe: ( any)[]>(...fs: FS) => (a: Parameters[0]) => ReturnType>) & { - fluent: (f: (a: A) => B) => Pipe; -}; diff --git a/dist/functions/pipe.js b/dist/functions/pipe.js deleted file mode 100644 index 56b78c4d..00000000 --- a/dist/functions/pipe.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pipe = void 0; -const fluent = (f) => { - function invoke(a) { - return f(a); - } - const p = Object.assign(invoke.bind(null), { - then: (f) => { - return next(p, f); - }, - invoke, - }); - return p; -}; -const next = (prev, f) => { - function invoke(a) { - return f(prev(a)); - } - const p = Object.assign(invoke.bind(null), { - then: (f) => { - return next(p, f); - }, - invoke, - }); - return p; -}; -/** - * ``` - * pipe :: (a⁰ => a¹, ..., aⁿ⁻¹ -> aⁿ) => a⁰ => aⁿ - * ``` - * - * Takes any number, _n_, unary Functions of the form `aˣ => aˣ⁺¹`, and composes - * them in a left-to-right order, passing the value, _a⁰_, to the left-most - * function, the return value, _a¹_ to the next-left-most function, etc., - * finally returning _aⁿ_. For example: - * - * ``` - * pipe(f, g, h)(a) <=> h(g(f(a))) - * ``` - * - * ## Warning - * - * While _pipe(...)_ can correctly detect the types of _a⁰_ and _aⁿ_, it cannot - * detect if the return type for an inner function fails to satisfy the type - * requirements for the next function. In the above example, the TypeScript - * Compiler will not consider it an error if _f_ returns a `number`, but _g_ - * accepts only a `string`. - * - * To guarantee type safety, use the _fluent_ API: - * - * ``` - * pipe.fluent(f).then(g).then(h).invoke(a) <=> h(g(f(a))) - * ``` - * - * The fluent algorithm guarantees that the return type of _f_ will match the - * argument type of _g_, that _g_ will match _h_, etc. Note that the final - * `invoke` method is equivalent to: - * - * ``` - * pipe.fluent(f).then(g).then(h)(a) - * ``` - * and if you assign a fluent chain to a variable you may treat it as a normal - * function. For example: - * ``` - * const fgh = pipe.fluent(f).then(g).then(h) - * fgh(a) <=> fgh.invoke(a) - * ``` - */ -exports.pipe = Object.assign( -// eslint-disable-next-line @typescript-eslint/no-explicit-any -(...fs) => { - return (a) => fs.reduce((v, f) => f(v), a); -}, { fluent }); diff --git a/dist/functions/pipeV.d.ts b/dist/functions/pipeV.d.ts deleted file mode 100644 index fe1112a3..00000000 --- a/dist/functions/pipeV.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * ``` - * pipeV :: (...as) => ((a⁰ => a¹), (a¹ => a²), ..., (aⁿ=> b)) => b - * ``` - * - * _PipeV_ is a _Variadic_ _Combinator_, that takes a __value__ and one or more - * _Unary_ __functions__. It _composes_ the functions in left-to-right order — - * evaluating the first function and applying it's result to the second, it's - * result to third, etc. — and returns the result of evaluating the final - * function. E.g.: - * - * ``` - * pipeV(v)(f, g, h) <=> h(g(f(v))) - * ``` - */ -export declare const pipeV: (...as: A[]) => (f: F, ...fs: Function[]) => any; diff --git a/dist/functions/pipeV.js b/dist/functions/pipeV.js deleted file mode 100644 index d636fb40..00000000 --- a/dist/functions/pipeV.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pipeV = void 0; -/** - * ``` - * pipeV :: (...as) => ((a⁰ => a¹), (a¹ => a²), ..., (aⁿ=> b)) => b - * ``` - * - * _PipeV_ is a _Variadic_ _Combinator_, that takes a __value__ and one or more - * _Unary_ __functions__. It _composes_ the functions in left-to-right order — - * evaluating the first function and applying it's result to the second, it's - * result to third, etc. — and returns the result of evaluating the final - * function. E.g.: - * - * ``` - * pipeV(v)(f, g, h) <=> h(g(f(v))) - * ``` - */ -exports.pipeV = (...as) => (f, ...fs) => fs.reduce((a, f) => f(a), f(...as)); diff --git a/dist/functions/prop.d.ts b/dist/functions/prop.d.ts deleted file mode 100644 index d37a00b4..00000000 --- a/dist/functions/prop.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * ``` - * prop :: k => { k: b } => b - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the value, __`b`__, of the given property key, __`k`__, for any - * object __`{ k: b }`__. - * - * ``` - * const obj = { - * foo: "FOO" - * }; - * obj.foo <=> prop("foo")(obj) <=> "FOO" - * ``` - */ -export declare const prop: (k: K) => (a: { [P in K]: B; }) => B; diff --git a/dist/functions/prop.js b/dist/functions/prop.js deleted file mode 100644 index 14b9c7cc..00000000 --- a/dist/functions/prop.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.prop = void 0; -/** - * ``` - * prop :: k => { k: b } => b - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the value, __`b`__, of the given property key, __`k`__, for any - * object __`{ k: b }`__. - * - * ``` - * const obj = { - * foo: "FOO" - * }; - * obj.foo <=> prop("foo")(obj) <=> "FOO" - * ``` - */ -exports.prop = (k) => (a) => a[k]; diff --git a/dist/functions/reduceRight.d.ts b/dist/functions/reduceRight.d.ts deleted file mode 100644 index d6b36803..00000000 --- a/dist/functions/reduceRight.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * ``` - * reduceRight :: ((a, b) => a) => a => [bⁿ, ..., b², b¹, b⁰] => a - * ``` - * ----------------------------------------------------------------------------- - * - * __reduceRight__ is a _Unary_ _Combinator_, that reduces an _Array_, in - * last-to-first order, to a single value. It does this by passing an initial - * value, the _accumulator_ and the last value of the _Array_, to _reducer_ - * function. The return value for that call is used as the accumulator for the - * next iteration. - * - */ -export declare const reduceRight: (reducer: (a: A, b: B) => A) => (a: A) => (bs: B[]) => A; diff --git a/dist/functions/reduceRight.js b/dist/functions/reduceRight.js deleted file mode 100644 index 0c6bb109..00000000 --- a/dist/functions/reduceRight.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.reduceRight = void 0; -/** - * ``` - * reduceRight :: ((a, b) => a) => a => [bⁿ, ..., b², b¹, b⁰] => a - * ``` - * ----------------------------------------------------------------------------- - * - * __reduceRight__ is a _Unary_ _Combinator_, that reduces an _Array_, in - * last-to-first order, to a single value. It does this by passing an initial - * value, the _accumulator_ and the last value of the _Array_, to _reducer_ - * function. The return value for that call is used as the accumulator for the - * next iteration. - * - */ -exports.reduceRight = (reducer) => (a) => (bs) => (bs.length > 0 ? bs.reduceRight(reducer, a) : a); diff --git a/dist/functions/replace.d.ts b/dist/functions/replace.d.ts deleted file mode 100644 index 790349d0..00000000 --- a/dist/functions/replace.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * ``` - * replace :: (s|r) => s => s => s - * ``` - * ----------------------------------------------------------------------------- - * - * Replaces parts of the __target__ _string_ that __match__ a given _string_ or - * _RegExp_, with the __replaceWith__ _string_. For example: - * - * ``` - * replace("foo")("bar")("foo baz bix") => "bar baz bix" - * replace(/foo/gi)("bar")("foo baz foo") => "bar baz bar" - * replace(/foo/gi)("bar")("foo baz foo") <=> "foo baz foo".replace(/foo/gi, "bar") - * ``` - * - */ -export declare const replace: (searchValue: string | RegExp) => (replaceValue: string) => (within: string) => string; diff --git a/dist/functions/replace.js b/dist/functions/replace.js deleted file mode 100644 index 43fb1605..00000000 --- a/dist/functions/replace.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.replace = void 0; -/** - * ``` - * replace :: (s|r) => s => s => s - * ``` - * ----------------------------------------------------------------------------- - * - * Replaces parts of the __target__ _string_ that __match__ a given _string_ or - * _RegExp_, with the __replaceWith__ _string_. For example: - * - * ``` - * replace("foo")("bar")("foo baz bix") => "bar baz bix" - * replace(/foo/gi)("bar")("foo baz foo") => "bar baz bar" - * replace(/foo/gi)("bar")("foo baz foo") <=> "foo baz foo".replace(/foo/gi, "bar") - * ``` - * - */ -exports.replace = (searchValue) => (replaceValue) => (within) => within.replace(searchValue, replaceValue); diff --git a/dist/functions/reverse.d.ts b/dist/functions/reverse.d.ts deleted file mode 100644 index 7c70998f..00000000 --- a/dist/functions/reverse.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * ``` - * reverse :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns an array created from __`as`__, sorted in reverse order. - * - * ``` - * const as = [1, 2, 3] - * Array.from(as).reverse() <=> reverse(as) <=> [3, 2, 1] - * ``` - */ -export declare const reverse: (as: ArrayLike) => A[]; diff --git a/dist/functions/reverse.js b/dist/functions/reverse.js deleted file mode 100644 index 2712afe7..00000000 --- a/dist/functions/reverse.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.reverse = void 0; -/** - * ``` - * reverse :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns an array created from __`as`__, sorted in reverse order. - * - * ``` - * const as = [1, 2, 3] - * Array.from(as).reverse() <=> reverse(as) <=> [3, 2, 1] - * ``` - */ -exports.reverse = (as) => Array.from(as).reverse(); diff --git a/dist/functions/slice.d.ts b/dist/functions/slice.d.ts deleted file mode 100644 index 8f15ad1e..00000000 --- a/dist/functions/slice.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * ``` - * slice->beginning :: n => m => as => as - * slice->end :: m => as => as - * slice->list :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns part of an array, __as__, from the beginning index, __n__, up to but - * not including the _end_ index, __m__. - * - * For example: - * - * ``` - * const as = [0, 1, 2, 3, 4] - * slice(1)(4)(as) <=> as.slice(1, 4) <=> [1, 2, 3] - * ``` - */ -export declare const slice: (n?: number | undefined) => (m?: number | undefined) => (as: Iterable | ArrayLike) => A[]; diff --git a/dist/functions/slice.js b/dist/functions/slice.js deleted file mode 100644 index 6e6861c0..00000000 --- a/dist/functions/slice.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.slice = void 0; -/** - * ``` - * slice->beginning :: n => m => as => as - * slice->end :: m => as => as - * slice->list :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns part of an array, __as__, from the beginning index, __n__, up to but - * not including the _end_ index, __m__. - * - * For example: - * - * ``` - * const as = [0, 1, 2, 3, 4] - * slice(1)(4)(as) <=> as.slice(1, 4) <=> [1, 2, 3] - * ``` - */ -exports.slice = (n) => (m) => (as) => Array.from(as).slice(n, m); diff --git a/dist/functions/sort.d.ts b/dist/functions/sort.d.ts deleted file mode 100644 index 953b4307..00000000 --- a/dist/functions/sort.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * sort :: ((a, a) => n) => as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Sorts a list by applying the given sorting function. - * - */ -export declare const sort: (compare: ((a1: A, a2: A) => number) | undefined) => (as: ArrayLike | Iterable) => A[]; diff --git a/dist/functions/sort.js b/dist/functions/sort.js deleted file mode 100644 index 9f453a11..00000000 --- a/dist/functions/sort.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.sort = void 0; -/** - * ``` - * sort :: ((a, a) => n) => as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Sorts a list by applying the given sorting function. - * - */ -exports.sort = (compare) => (as) => Array.from(as).sort(compare); diff --git a/dist/functions/split.d.ts b/dist/functions/split.d.ts deleted file mode 100644 index 467a9b61..00000000 --- a/dist/functions/split.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ``` - * split->at :: (s, n) => s => ss - * split->what :: s => ss - * ``` - * ----------------------------------------------------------------------------- - * - * Safely split a _string_ into one or more parts by the given __`separator`__ - * string or regular expression: - * - * ``` - * const s = "one two three" - * split(" ")(s) <=> s.split(" ") <=> ["one", "two", "three"] - * ``` - * - * while respecting surrogate pairs: - * - * ``` - * split("")("𝟘𝟙𝟚𝟛") <=> ["𝟘", "𝟙", "𝟚", "𝟛"] !=> "𝟘𝟙𝟚𝟛".split("") - * ``` - * - * or putting a __`limit`__ on the number of elements returned: - * - * ``` - * split(" ", 2)(s) <=> ["one", "two"] - * split(" ", 9)(s) <=> ["one", "two", "three"] - * ``` - */ -export declare const split: (separator?: string | RegExp | undefined, limit?: number | undefined) => (source: string) => string[]; diff --git a/dist/functions/split.js b/dist/functions/split.js deleted file mode 100644 index e65ae31e..00000000 --- a/dist/functions/split.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.split = void 0; -/** - * ``` - * split->at :: (s, n) => s => ss - * split->what :: s => ss - * ``` - * ----------------------------------------------------------------------------- - * - * Safely split a _string_ into one or more parts by the given __`separator`__ - * string or regular expression: - * - * ``` - * const s = "one two three" - * split(" ")(s) <=> s.split(" ") <=> ["one", "two", "three"] - * ``` - * - * while respecting surrogate pairs: - * - * ``` - * split("")("𝟘𝟙𝟚𝟛") <=> ["𝟘", "𝟙", "𝟚", "𝟛"] !=> "𝟘𝟙𝟚𝟛".split("") - * ``` - * - * or putting a __`limit`__ on the number of elements returned: - * - * ``` - * split(" ", 2)(s) <=> ["one", "two"] - * split(" ", 9)(s) <=> ["one", "two", "three"] - * ``` - */ -exports.split = (separator, limit) => (source) => separator == undefined - ? [source] - : separator === "" - ? Array.from(source).slice(0, limit) - : source.split(separator, limit); diff --git a/dist/functions/tail.d.ts b/dist/functions/tail.d.ts deleted file mode 100644 index 2665adbc..00000000 --- a/dist/functions/tail.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * tail :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the portion of an array not including the first element. - * - */ -export declare const tail: ([, ...as]: readonly A[]) => A[]; diff --git a/dist/functions/tail.js b/dist/functions/tail.js deleted file mode 100644 index faad8dbd..00000000 --- a/dist/functions/tail.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.tail = void 0; -/** - * ``` - * tail :: as => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the portion of an array not including the first element. - * - */ -exports.tail = ([, ...as]) => as; diff --git a/dist/functions/take.d.ts b/dist/functions/take.d.ts deleted file mode 100644 index 6eb60b93..00000000 --- a/dist/functions/take.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * take :: (n, as) => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the first _n_ elements of the given list. - * - */ -export declare const take: (n: number) => (as: readonly A[]) => A[]; diff --git a/dist/functions/take.js b/dist/functions/take.js deleted file mode 100644 index 3944d098..00000000 --- a/dist/functions/take.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.take = void 0; -/** - * ``` - * take :: (n, as) => as - * ``` - * ----------------------------------------------------------------------------- - * - * Returns the first _n_ elements of the given list. - * - */ -exports.take = (n) => (as) => as.slice(0, n); diff --git a/dist/functions/tap.d.ts b/dist/functions/tap.d.ts deleted file mode 100644 index e0fd8ae0..00000000 --- a/dist/functions/tap.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * tap :: (a -> *) -> a -> a - * ``` - * ----------------------------------------------------------------------------- - * Takes a function, a _value_, and applies the value to the function for it's - * _sideEffect_. Ignores any value returned by the side effect function, and - * returns the _value_ instead. - */ -export declare const tap: (f: (a: A) => void) => (a: A) => A; diff --git a/dist/functions/tap.js b/dist/functions/tap.js deleted file mode 100644 index 4f03576b..00000000 --- a/dist/functions/tap.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.tap = void 0; -/** - * ``` - * tap :: (a -> *) -> a -> a - * ``` - * ----------------------------------------------------------------------------- - * Takes a function, a _value_, and applies the value to the function for it's - * _sideEffect_. Ignores any value returned by the side effect function, and - * returns the _value_ instead. - */ -exports.tap = (f) => (a) => { - f(a); - return a; -}; diff --git a/dist/functions/toArray.d.ts b/dist/functions/toArray.d.ts deleted file mode 100644 index 785416c4..00000000 --- a/dist/functions/toArray.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ``` - * toString :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Unary_ function that accepts an array as its argument, and returns - * that accepts any number of arguments instead. - * - */ -export declare const toArray: (as: Iterable | ArrayLike) => A[]; diff --git a/dist/functions/toArray.js b/dist/functions/toArray.js deleted file mode 100644 index 01c82f0a..00000000 --- a/dist/functions/toArray.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toArray = void 0; -/** - * ``` - * toString :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Unary_ function that accepts an array as its argument, and returns - * that accepts any number of arguments instead. - * - */ -exports.toArray = (as) => Array.from(as); diff --git a/dist/functions/toString.d.ts b/dist/functions/toString.d.ts deleted file mode 100644 index 12e8dee0..00000000 --- a/dist/functions/toString.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * toString :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes any JavaScript value and returns a string version of that value. - * - */ -export declare const toString: (a: unknown) => string; diff --git a/dist/functions/toString.js b/dist/functions/toString.js deleted file mode 100644 index ffe22952..00000000 --- a/dist/functions/toString.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toString = void 0; -/** - * ``` - * toString :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes any JavaScript value and returns a string version of that value. - * - */ -exports.toString = (a) => `${a}`; diff --git a/dist/functions/toUnary.d.ts b/dist/functions/toUnary.d.ts deleted file mode 100644 index 1e6126c7..00000000 --- a/dist/functions/toUnary.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ``` - * toUnary :: (...as => b) => as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Variadic_ function and returns a _Unary_ version of the function - * that accepts a single array as its argument instead. - * - */ -export declare function toUnary(v: (...as: AS) => B): (as: AS) => B; diff --git a/dist/functions/toUnary.js b/dist/functions/toUnary.js deleted file mode 100644 index 77e11c5d..00000000 --- a/dist/functions/toUnary.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toUnary = void 0; -/** - * ``` - * toUnary :: (...as => b) => as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Variadic_ function and returns a _Unary_ version of the function - * that accepts a single array as its argument instead. - * - */ -function toUnary(v) { - return (as) => v(...as); -} -exports.toUnary = toUnary; diff --git a/dist/functions/toVariadic.d.ts b/dist/functions/toVariadic.d.ts deleted file mode 100644 index 7c929327..00000000 --- a/dist/functions/toVariadic.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ``` - * toVariadic :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Unary_ function that accepts an array as its only argument, and - * returns a function that accepts any number of arguments instead. - * - */ -export declare const toVariadic: (u: (as: AS) => B) => (...as: AS) => B; diff --git a/dist/functions/toVariadic.js b/dist/functions/toVariadic.js deleted file mode 100644 index 57658b7c..00000000 --- a/dist/functions/toVariadic.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.toVariadic = void 0; -/** - * ``` - * toVariadic :: (as => b) => ...as => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a _Unary_ function that accepts an array as its only argument, and - * returns a function that accepts any number of arguments instead. - * - */ -exports.toVariadic = (u) => (...as) => u(as); diff --git a/dist/functions/trim.d.ts b/dist/functions/trim.d.ts deleted file mode 100644 index f94751b4..00000000 --- a/dist/functions/trim.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * ``` - * trim :: s => s - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a string and trims any whitespace characters that appear at the - * beginning or end, as in: - * - * ``` - * trim(" s ") <=> " s ".trim() <=> "s" - * ``` - * - */ -export declare const trim: (s: string) => string; diff --git a/dist/functions/trim.js b/dist/functions/trim.js deleted file mode 100644 index 85299b68..00000000 --- a/dist/functions/trim.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.trim = void 0; -/** - * ``` - * trim :: s => s - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a string and trims any whitespace characters that appear at the - * beginning or end, as in: - * - * ``` - * trim(" s ") <=> " s ".trim() <=> "s" - * ``` - * - */ -exports.trim = (s) => s.trim(); diff --git a/dist/functions/uncurry.d.ts b/dist/functions/uncurry.d.ts deleted file mode 100644 index 97f44efb..00000000 --- a/dist/functions/uncurry.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * ``` - * uncurry :: n => (a¹ => a² => ... => aⁿ => b) => (a¹, a², ..., aⁿ) => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a length, _n_, a _curried_ function with _n_ productions, and returns a - * function that accepts _n_ arguments. - * - * ``` - * uncurry(3, a => b => c => a + b + c) <=> (a, b, c) => a + b + c - * ``` - * @todo add support for Variadic Tuples in TypeScript 4 - */ -export declare const uncurry: (length: number) => (curried: (a: A) => B) => (...allArguments: AS) => (a: A) => B; diff --git a/dist/functions/uncurry.js b/dist/functions/uncurry.js deleted file mode 100644 index dcca2766..00000000 --- a/dist/functions/uncurry.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.uncurry = void 0; -const applyArgument = (currentStep, a) => currentStep(a); -/** - * ``` - * uncurry :: n => (a¹ => a² => ... => aⁿ => b) => (a¹, a², ..., aⁿ) => b - * ``` - * ----------------------------------------------------------------------------- - * - * Takes a length, _n_, a _curried_ function with _n_ productions, and returns a - * function that accepts _n_ arguments. - * - * ``` - * uncurry(3, a => b => c => a + b + c) <=> (a, b, c) => a + b + c - * ``` - * @todo add support for Variadic Tuples in TypeScript 4 - */ -exports.uncurry = (length) => (curried) => (...allArguments) => { - const expectedArguments = allArguments.slice(0, length); - return expectedArguments.reduce(applyArgument, curried); -}; diff --git a/dist/functions/unless.d.ts b/dist/functions/unless.d.ts deleted file mode 100644 index 8bb02652..00000000 --- a/dist/functions/unless.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ``` - * unless :: (a => boolean) => (a => b) => a => a|b - * ``` - * ----------------------------------------------------------------------------- - * - * Return `a => b` __unless__ the `a => boolean` is `true`, in that case return - * `a`. - */ -export declare const unless: (p: (a: X) => a is A) => (mapXB: (x: X) => B) => (a: X) => A | B; diff --git a/dist/functions/unless.js b/dist/functions/unless.js deleted file mode 100644 index 0dd3acf9..00000000 --- a/dist/functions/unless.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.unless = void 0; -/** - * ``` - * unless :: (a => boolean) => (a => b) => a => a|b - * ``` - * ----------------------------------------------------------------------------- - * - * Return `a => b` __unless__ the `a => boolean` is `true`, in that case return - * `a`. - */ -exports.unless = (p) => (mapXB) => (a) => (p(a) ? a : mapXB(a)); diff --git a/dist/index.d.ts b/dist/index.d.ts index 5f286ff0..5cf09d41 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1 +1 @@ -export * from "./functions"; +export * from "./app/functions"; diff --git a/dist/index.js b/dist/index.js index 56a0bb2b..d91df5dc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,13 +1,4 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./functions"), exports); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./app/functions"), exports); diff --git a/dist/lib/describe.d.ts b/dist/lib/describe.d.ts new file mode 100644 index 00000000..8f9761cc --- /dev/null +++ b/dist/lib/describe.d.ts @@ -0,0 +1 @@ +export { describe } from "@mwm/describe"; diff --git a/dist/lib/describe.js b/dist/lib/describe.js new file mode 100644 index 00000000..9ed07b57 --- /dev/null +++ b/dist/lib/describe.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.describe = void 0; +var describe_1 = require("@mwm/describe"); +Object.defineProperty(exports, "describe", { enumerable: true, get: function () { return describe_1.describe; } }); diff --git a/dist/lib/readdir.d.ts b/dist/lib/readdir.d.ts new file mode 100644 index 00000000..d2811ee2 --- /dev/null +++ b/dist/lib/readdir.d.ts @@ -0,0 +1,3 @@ +/// +import { readdir as rd } from "fs"; +export declare const readdir: typeof rd.__promisify__; diff --git a/dist/lib/readdir.js b/dist/lib/readdir.js new file mode 100644 index 00000000..864d3172 --- /dev/null +++ b/dist/lib/readdir.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readdir = void 0; +const fs_1 = require("fs"); +const util_1 = require("util"); +exports.readdir = util_1.promisify(fs_1.readdir);