Skip to content

Commit

Permalink
Merge pull request #4 from finleap-connect/chore/bundle-size
Browse files Browse the repository at this point in the history
chore: fix issues related to bundle size convert from cjs to esm to enable tree shaking
  • Loading branch information
josipbrcina authored Dec 1, 2021
2 parents d659aa5 + 3570ded commit c3298ff
Show file tree
Hide file tree
Showing 252 changed files with 14,887 additions and 14,878 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"presets": ["@babel/preset-env"]
"presets": [
"@babel/preset-env",
{
"modules": false
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![version][version-badge]][changelog]

[changelog]: CHANGELOG.md
[version-badge]: https://img.shields.io/badge/version-0.1.5-blue.svg
[version-badge]: https://img.shields.io/badge/version-0.1.6-blue.svg

# LJSP: Embrace the Lisp in JavaScript!
Whether you agree that JavaScript is a Lisp or not, you can still harness the Lisp-inspired power of LJSP in your app. LJSP derives most of its functions from Clojure libraries. Clojurians will notice the extent to which we treated the Clojure docs not only as our requirements' specification, but as a great place to copy and paste text for our docs! For this, we offer heart-felt, tremendous thanks to the Clojure community.
Expand Down
1 change: 1 addition & 0 deletions lib/conditional/and.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function and(...rest: Array<any>): any;
17 changes: 17 additions & 0 deletions lib/conditional/cases.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TPrimitive } from "../types/TPrimitive";
/**
* Takes an expression, and a set of clauses.
* Each clause can take the form of either:
* test-constant result-expr
* (test-constant1 ... test-constantN) result-expr
* The test-constants are not evaluated. They must be compile-time
* literals. If the expression is equal to a
* test-constant, the corresponding result-expr is returned. A single
* default expression can follow the clauses, and its value will be
* returned if no clause matches. If no default expression is provided
* and no clause matches, undefined is returned.
* All manner of constant expressions are acceptable in `cases`,
* including numbers, strings, booleans, and Symbols. The
* test-constants need not be all of the same type.
*/
export declare function cases(expression: TPrimitive, ...rest: any[]): any;
2 changes: 2 additions & 0 deletions lib/conditional/cond.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const ELSE = "else";
export declare function cond(...rest: Array<any>): any;
19 changes: 19 additions & 0 deletions lib/conditional/condp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Takes a binary predicate, an expression, and a set of clauses.
* Each clause can take the form of either:
* test-expr, result-expr
* test-expr, result-fn
* For each clause, (pred test-expr expr) is evaluated. If it returns
* logical true, the clause is a match. If a binary clause matches, the
* result-expr is returned, if a ternary clause matches, its result-fn,
* which must be a unary function, is called with the result of the
* predicate as its argument, the result of that call being the return
* value of condp. A single default expression can follow the clauses,
* and its value will be returned if no clause matches. If no default
* expression is provided and no clause matches, undefined is returned.
* @param {function} pred
* @param {*} expr
* @param {*} rest
* @returns {*}
*/
export declare function condp(pred: any, expr: any, ...rest: any[]): any;
5 changes: 5 additions & 0 deletions lib/conditional/every-pred.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param rest
* @returns {function(...[*]): boolean}
*/
export declare function everyPred(...rest: any[]): (...args: any[]) => boolean;
7 changes: 7 additions & 0 deletions lib/conditional/if-array.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Returns either the value or an empty Array
* @param {boolean} pred
* @param {*} value
* @returns {*|*[]}
*/
export declare function ifArray(pred: boolean, value: any): any;
6 changes: 6 additions & 0 deletions lib/conditional/if-blank.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @param {boolean | Function} condition
* @param {*} consequent
* @returns {*|string}
*/
export declare function ifBlank(condition: any, consequent: any): any;
6 changes: 6 additions & 0 deletions lib/conditional/if-class.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @param {boolean | Function} condition
* @param {string} className
* @returns {*|string}
*/
export declare function ifClass(condition: any, className: any): any;
6 changes: 6 additions & 0 deletions lib/conditional/if-not.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @param condition
* @param expression
* @returns {*|undefined}
*/
export declare function ifNot(condition: any, expression: any): any;
6 changes: 6 additions & 0 deletions lib/conditional/if-obj.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @param {boolean | Function} condition
* @param {{}} consequent
* @returns {*|string}
*/
export declare function ifObj(condition: any, consequent: any): any;
7 changes: 7 additions & 0 deletions lib/conditional/if-some.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @param value
* @param ifTrue
* @param ifFalse
* @returns {*}
*/
export declare function ifSome(value: any, ifTrue: any, ifFalse: any): any;
1 change: 1 addition & 0 deletions lib/conditional/if-yes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function ifYes(condition: any, expression: any): any;
1 change: 1 addition & 0 deletions lib/conditional/iff.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function iff(condition: any, ifTrue: any, ifFalse: any): any;
18 changes: 18 additions & 0 deletions lib/conditional/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export { and } from "./and";
export { cases } from "./cases";
export { cond, ELSE } from "./cond";
export { condp } from "./condp";
export { everyPred } from "./every-pred";
export { ifArray } from "./if-array";
export { ifBlank } from "./if-blank";
export { ifClass } from "./if-class";
export { ifNot } from "./if-not";
export { ifObj } from "./if-obj";
export { ifSome } from "./if-some";
export { ifYes } from "./if-yes";
export { iff } from "./iff";
export { or } from "./or";
export { some$ } from "./some$";
export { when } from "./when";
export { whenFirst } from "./when-first";
export { whenNot } from "./when-not";
1 change: 1 addition & 0 deletions lib/conditional/internal/_return-last.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function _returnLast(body: Array<any>, arg?: any): any;
3 changes: 3 additions & 0 deletions lib/conditional/internal/run-fn-or-get-value.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare type IsBoolean = any | ((arg: any) => any);
export declare function runFnOrGetValue(ifTrue: IsBoolean, value?: any): any;
export {};
1 change: 1 addition & 0 deletions lib/conditional/or.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function or(...rest: Array<any>): any;
5 changes: 5 additions & 0 deletions lib/conditional/some$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param expression
* @returns {boolean}
*/
export declare function some$(expression: any): boolean;
7 changes: 7 additions & 0 deletions lib/conditional/when-first.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Obtains the first item in a set. If that item is truthy, then the body is run and the last
* computed value or expression is returned. The first item in the list is passed as an argument
* to any functions in the function body.
* Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once
*/
export declare function whenFirst(set: Array<any>, ...rest: any): any;
5 changes: 5 additions & 0 deletions lib/conditional/when-not.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param condition
* @param rest
*/
export declare function whenNot(condition: any, ...rest: Array<any>): any;
5 changes: 5 additions & 0 deletions lib/conditional/when.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param condition
* @param rest
*/
export declare function when(condition: any, ...rest: Array<any>): any;
15 changes: 15 additions & 0 deletions lib/enums/base-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export declare enum BaseTypes {
Function = "function",
String = "string",
Object = "object",
Array = "array",
Map = "map",
Set = "set",
Boolean = "boolean",
Number = "number",
Null = "null",
Undefined = "undefined",
Promise = "promise",
Date = "date",
Symbol = "symbol"
}
1 change: 1 addition & 0 deletions lib/function/apply.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function apply(fn: Function, ...rest: Array<any>): any;
1 change: 1 addition & 0 deletions lib/function/comp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function comp(...fns: Array<Function>): (...args: Array<any>) => any[];
1 change: 1 addition & 0 deletions lib/function/complement.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function complement(fn: any): (...rest: any[]) => boolean;
1 change: 1 addition & 0 deletions lib/function/constantly.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const constantly: (value: any) => () => any;
3 changes: 3 additions & 0 deletions lib/function/f-nil.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare type FnType = (args?: Array<any>) => any;
export declare function fNil(fn: FnType, ...template: Array<any>): FnType;
export {};
1 change: 1 addition & 0 deletions lib/function/identity.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function identity(value: any): any;
12 changes: 12 additions & 0 deletions lib/function/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export { apply } from "./apply";
export { comp } from "./comp";
export { complement } from "./complement";
export { constantly } from "./constantly";
export { fNil } from "./f-nil";
export { identity } from "./identity";
export { juxt } from "./juxt";
export { memoize } from "./memoize";
export { partial } from "./partial";
export { repeatedly } from "./repeatedly";
export { tf } from "./tf";
export { trampoline } from "./trampoline";
5 changes: 5 additions & 0 deletions lib/function/juxt.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param {*} rest
* @returns {function(...[*]=): unknown}
*/
export declare function juxt(...rest: any[]): (...args: any[]) => any;
4 changes: 4 additions & 0 deletions lib/function/memoize.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare type Function = (...args: any) => any;
declare type ResolverFn = (...args: any) => string;
export declare function memoize(fn: Function, cacheKey?: ResolverFn): any;
export {};
1 change: 1 addition & 0 deletions lib/function/partial.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function partial(fn: Function, ...rest: any[]): (...args: any[]) => any;
1 change: 1 addition & 0 deletions lib/function/repeatedly.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function repeatedly(fn: Function, n: number): any;
5 changes: 5 additions & 0 deletions lib/function/tf.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Used to flatten nested function calls. `tf` allows value transformations to be
* expressed as “pipelines” of values, similar to Unix pipes.
*/
export declare function tf(val: any, ...fns: Function[]): any;
14 changes: 14 additions & 0 deletions lib/function/trampoline.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* `trampoline` can be used to convert recursive algorithms
* without stack consumption. Calls `fn` with supplied args, if
* any. If `fn` returns a function, calls that function with no
* arguments, and continues to repeat, until the return value is
* not a function, then returns that non-fn value. Note that if
* you want to return a function as a final value, you must wrap
* it in some data structure and unpack it after `trampoline`
* returns.
* @param {Function} fn
* @param {*} rest
* @returns {function(...[*]): *}
*/
export declare function trampoline(fn: any, ...rest: any[]): any;
1 change: 1 addition & 0 deletions lib/generic/alike.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function alike(...rest: Array<any>): boolean;
1 change: 1 addition & 0 deletions lib/generic/array$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function array$(item: any): boolean;
1 change: 1 addition & 0 deletions lib/generic/array-like$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function arrayLike$(set: any): any;
1 change: 1 addition & 0 deletions lib/generic/array-set$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function arraySet$(set: Array<any>): boolean;
6 changes: 6 additions & 0 deletions lib/generic/boolean$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Whether a value is Boolean
* @param value
* @returns {boolean|*}
*/
export declare function boolean$(value: any): boolean;
2 changes: 2 additions & 0 deletions lib/generic/clone-deep.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const cloneDeepNoCircularRefs: (o: any) => any;
export declare const cloneDeep: (o: any) => any;
1 change: 1 addition & 0 deletions lib/generic/collection$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function collection$(item: any): any;
13 changes: 13 additions & 0 deletions lib/generic/compare.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Returns a negative number, zero, or a positive number
* when x is logically 'less than', 'equal to', or 'greater than'
* y. Works with number, string, and boolean values---as well as Arrays
* of those values. Compares numbers and Arrays in a type-independent
* manner; however the types compared must always match.
*
* When comparing strings, a delta in a string returns the distance between
* the first two letters that don't match. See examples below for deta
* @param left
* @param right
*/
export declare function compare(left: any, right: any): number;
1 change: 1 addition & 0 deletions lib/generic/deep-eq.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function deepEq(...rest: Array<any>): boolean;
16 changes: 16 additions & 0 deletions lib/generic/diff.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TAnyObject } from "../types/t-any-object";
/**
* Recursively compares a and b, returning a tuple of
* [things-only-in-a things-only-in-b things-in-both].
* Comparison rules:
* * For equal a and b, return [nil nil a].
* * Maps are subdiffed where keys match and values differ.
* * Sets are never subdiffed.
* * All sequential things are treated as associative collections
* by their indexes, with results returned as vectors.
* * Everything else (including strings!) is treated as
* an atom and compared for equality.
* @param a
* @param b
*/
export declare function diff(a: TAnyObject, b: TAnyObject): any;
2 changes: 2 additions & 0 deletions lib/generic/distinct$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { TPrimitive } from "../types/TPrimitive";
export declare function distinct$(...rest: Array<TPrimitive>): boolean;
1 change: 1 addition & 0 deletions lib/generic/do-work.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function doWork(...rest: Array<any>): any;
1 change: 1 addition & 0 deletions lib/generic/dotimes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function dotimes(times: number, fn: Function): void;
8 changes: 8 additions & 0 deletions lib/generic/empty$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { TCollection } from "../types/t-collection";
/**
* Returns whether an Object, an Array, a Set, or a Map is empty.
* Modified slightly from Lodash
* @param value
* @returns {boolean}
*/
export declare function empty$(value: null | undefined | TCollection): boolean;
1 change: 1 addition & 0 deletions lib/generic/empty.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function empty(set: any): any;
1 change: 1 addition & 0 deletions lib/generic/eq.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function eq(...rest: Array<any>): boolean;
1 change: 1 addition & 0 deletions lib/generic/false$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function false$(arg: any): boolean;
1 change: 1 addition & 0 deletions lib/generic/function$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function function$(value: any): boolean;
5 changes: 5 additions & 0 deletions lib/generic/function-set$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param {[]} set
* @returns {Boolean}
*/
export declare function functionSet$(set: any): boolean;
40 changes: 40 additions & 0 deletions lib/generic/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export { alike } from "./alike";
export { array$ } from "./array$";
export { arrayLike$ } from "./array-like$";
export { arraySet$ } from "./array-set$";
export { boolean$ } from "./boolean$";
export { cloneDeep } from "./clone-deep";
export { cloneDeepNoCircularRefs } from "./clone-deep";
export { collection$ } from "./collection$";
export { compare } from "./compare";
export { deepEq } from "./deep-eq";
export { diff } from "./diff";
export { distinct$ } from "../generic/distinct$";
export { doWork } from "./do-work";
export { dotimes } from "./dotimes";
export { empty$ } from "./empty$";
export { empty } from "./empty";
export { eq } from "./eq";
export { false$ } from "./false$";
export { function$ } from "./function$";
export { functionSet$ } from "./function-set$";
export { log } from "./log";
export { maxKey } from "./max-key";
export { not } from "./not";
export { notEmpty$ } from "./not-empty$";
export { notEmpty } from "./not-empty";
export { notEq } from "./not-eq";
export { number$ } from "./number$";
export { numberSet$ } from "./number-set$";
export { numeric$ } from "./numeric$";
export { object$ } from "./object$";
export { objectLike$ } from "./object-like$";
export { objectSet$ } from "./object-set$";
export { orEq } from "./or-eq";
export { rand } from "./rand";
export { regExp$ } from "./reg-exp$";
export { string$ } from "./string$";
export { stringSet$ } from "./string-set$";
export { true$ } from "./true$";
export { undefined$ } from "./undefined$";
export { void$ } from "./void$";
1 change: 1 addition & 0 deletions lib/generic/internal/_eq.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function _eq(args: any, comparator: Function): boolean;
1 change: 1 addition & 0 deletions lib/generic/internal/is-multi-dim-arr.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function isMultiDimArr(arr: any): any;
3 changes: 3 additions & 0 deletions lib/generic/internal/typed-set$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare type TypeFn = (arg?: any) => boolean;
export declare function typedSet$(set: Array<any>, fn: TypeFn): boolean;
export {};
1 change: 1 addition & 0 deletions lib/generic/log.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function log(...rest: any): void;
1 change: 1 addition & 0 deletions lib/generic/max-key.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function maxKey(fn: any, ...rest: any[]): any;
5 changes: 5 additions & 0 deletions lib/generic/not-empty$.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @param item
* @returns {boolean}
*/
export declare function notEmpty$(item: any): boolean;
2 changes: 2 additions & 0 deletions lib/generic/not-empty.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { TCollection } from "../types/t-collection";
export declare function notEmpty(set: TCollection): string | object | undefined;
1 change: 1 addition & 0 deletions lib/generic/not-eq.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function notEq(...rest: Array<any>): boolean;
Loading

0 comments on commit c3298ff

Please sign in to comment.