import { get, match, not, otherwise, Pipe, trace } from "./utils"; export { get, match, not, otherwise, Pipe, trace }; /** Returns a [constant function](https://en.wikipedia.org/wiki/Constant_function) of `x` */ export declare const always: (x: any) => () => any; /** Compares to `null` and `undefined` */ export declare const exists: (x: any) => boolean; /** [Identity function](https://en.wikipedia.org/wiki/Identity_function) */ export declare const id: (x: any) => any; /** Returns `x` if it exists. Otherwise returns `fallback` */ export declare const or: (fallback: any) => (x: any) => any; /** Always returns `false` */ export declare const no: () => boolean; /** [No operation](https://en.wikipedia.org/wiki/NOP_(code)). Always returns `undefined` */ export declare const noop: () => void; /** Always returns `true` */ export declare const yes: () => boolean; /** Runs the `ifFunc` or the `elseFunc` based on the result of `predicate(v)` */ export declare const mapIf: (predicate: any, ifFunc?: (x: any) => any, elseFunc?: (x: any) => any) => (v: any) => any; /** Is `a` greater than `b`? */ export declare const gt: (b: any) => (a: any) => boolean; /** Is `a` greater than or equal to `b`? */ export declare const gte: (b: any) => (a: any) => boolean; /** Is `a` less than `b`? */ export declare const lt: (b: any) => (a: any) => boolean; /** Is `a` less than or equal to `b`? */ export declare const lte: (b: any) => (a: any) => boolean; /** Is `a` equal to `b`? */ export declare const is: (a: any) => (b: any) => boolean; export declare const isNumber: (n: any) => boolean; export declare const isString: (n: any) => boolean; export declare const isEven: (n: any) => boolean; export declare const isOdd: (n: any) => boolean; export declare const isOneOf: (...values: any[]) => (v: any) => boolean; export declare const isAtPath: (path: any, predicate: any) => (v: any) => any; export declare const isAtIndex: (index: any, predicate: any) => (v: any) => any; /** Checks whether the `v` fulfils all the `predicates` */ export declare const isAll: (...predicates: any[]) => (v: any) => any; /** Checks whether the `v` fulfils some of the `predicates` */ export declare const isSome: (...predicates: any[]) => (v: any) => any; export declare const charCodeAt: (index: any) => (str: any) => number; export declare const endsWith: (term: any) => (str: any) => boolean; export declare const fromCharCode: (num: any) => string; export declare const padEnd: (length: any, char: any) => (str: any) => string; export declare const padStart: (length: any, char: any) => (str: any) => string; export declare const repeat: (length: any) => (str: any) => string; export declare const replace: (regexp: any, newStr: any) => (str: any) => string; export declare const split: (sep: any) => (str: any) => string[]; export declare const startsWith: (term: any) => (str: any) => boolean; export declare const substring: (start: any, end: any) => (str: any) => string; export declare const toLowerCase: (str: any) => string; export declare const toUpperCase: (str: any) => string; export declare const trim: (str: any) => string; /** Creates an array. Kind of similar to list comprehension in python ```js array(5); // [0, 1, 2, 3, 4, 5] array(5, add(1), isEven); // [0, 3, 5] ``` */ export declare const array: (range?: number, mapper?: (x: any) => any, filter?: (v: any) => boolean) => any[]; /** Concatenates `b` into `a`. Does not concat `undefined` or `null` ```js concat(2)([1]); // [1, 2] ``` */ export declare const concat: (b: any) => (a: any) => any[]; /** Concatenates `a` into `b`. Does not concat `undefined` or `null` ```js concat([1])(2); // [1, 2] ``` */ export declare const concatRight: (a: any) => (b: any) => any[]; export declare const every: (func: any) => (arr: any) => boolean; export declare const filter: (func: any) => (arr: any) => {}[]; export declare const find: (func: any) => (arr: any) => {} | undefined; export declare const findIndex: (func: any) => (arr: any) => number; export declare const forEach: (...funcs: any[]) => (arr: any) => void; export declare const includes: (thing: any) => (arr: any) => boolean; export declare const indexOf: (term: any) => (arr: any) => number; export declare const join: (sep: string) => (arr: any) => string; export declare const length: (arr: any) => number; export declare const map: (...funcs: any[]) => (arr: any) => any[]; export declare const reverse: (arr: any) => any[]; export declare const slice: (begin: any, end: any) => (arr: any) => any[]; export declare const some: (func: any) => (arr: any) => boolean; export declare const sort: (func: any) => (arr: any) => any[]; /** Sort objects or arrays by key or index (or both) ```js sortBy("a[0]")([{ a: [3] }, { a: [2] }, { a: [1] }]); // [{ a: [1] }, { a: [2] }, { a: [3] }] ``` */ export declare const sortBy: (path?: string) => (arr: any) => any[]; /** See `reduce` for documentation */ export declare const plainReduce: (func: any, initial: any) => (arr: any) => any; /** See `reduce` for documentation */ export declare const mapFilterReduce: (reducer: any, initial: any, map: any, filter?: (v: any) => boolean) => (arr: any) => any; /** Note that `reducer` needs to be a higher order unary function (returning another unary function) and that the order of the current and accumulator are reversed. This makes it possible to use other functions from this package as the `reducer`. ```js reduce(curr => accum => accum + curr, 0)([1, 2, 3]); // 6 reduce(add, 0)([1, 2, 3]); // 6 reduce(concat, [])([[1, 2], [3, 4]]); // [1, 2, 3, 4] ``` `map` and `filter` can be used to do many operations that otherwise would require iterating over a list many times, like `[].filter(fn).map(fn).reduce(fn)` which can be orders of magnitude slower. Filtering happens before mapping. ```js const numbers = [1, 2, 3, 4]; // 4 iterations reduce(add, 0, pow(2), isEven)(numbers); // 20 // 4 + 2 + 2 iterations Pipe(filter(isEven), map(pow(2)), reduce(add))(numbers); // 20 ``` */ export declare const reduce: (reducer: any, initial: any, map: any, filter: any) => (arr: any) => any; /** Unary version of parseInt (can safely be used in `map` etc) */ export declare const int: (n: any) => number; /** Unary version of parseFloat (can safely be used in `map` etc) */ export declare const float: (n: any) => number; export declare const toFixed: (digits: number) => (num: number) => string; export declare const add: (b: any) => (a: any) => any; export declare const divide: (b: any) => (a: any) => number; export declare const multiply: (b: any) => (a: any) => number; export declare const subtract: (b: any) => (a: any) => number; export declare const max: (arr: any) => number; export declare const min: (arr: any) => number; export declare const clamp: (min: any, max: any) => (n: any) => number; export declare const pow: (exp: any) => (base: any) => number; export declare const rangeMap: (inMin: any, inMax: any, outMin: any, outMax: any) => (n: any) => any; export declare const assign: (b: any) => (a: any) => any; /** Checks whether `obj` has a value at the given `path`. Not to be confused with `object.hasOwnProperty` */ export declare const has: (path?: string) => (obj: any) => boolean; export declare const objectFromEntry: ([k, v]?: [(string | undefined)?, any?]) => { [x: string]: any; }; export declare const mapEntry: (mapKey: any, mapValue: any) => ([k, v]?: [(string | undefined)?, any?]) => any[]; export declare const mapObject: (map: any, filter: any) => (obj?: {}) => any;