Home Reference Source Test

References

Array

summary
public

F any(source: Array<T>, fn: Function): boolean

Checks if predicate returns truthy for any element of collection.

public

F castArray(valueToCast: ...T): Array<T>

Casts values as an array if it's not one.

public

F changeOrder(source: Array<T>, order: Array<number>): Array<T>

Returns array with changed order.

public

F cloneArray(source: Array<T>): Array<T>

Will create clone of given array.

public

F compact(source: Array<T>): Array<T>

Creates an array with all falsey values removed.

public

F every(source: Array<T>, fn: Function): boolean

Checks if predicate returns truthy for all elements of collection.

public

F fill(source: T, number: number): Array<T>

Will fill array by given value.

public

F fillLeft(value: T, number: number, source: Array<T|D>): Array<T|D>

Will fill array in the begining for n elements and add given array in the end.

public

F fillRight(value: T, number: number, source: Array<T|D>): Array<T|D>

Will fill array in the end for n elements and add given array from begining.

public

F filter(source: Array<T>, fn: Function): Array<T>

Will filter an array.

public

F find(source: Array<T>, fn: Function): T

Iterates over elements of collection, returning the first element predicate returns truthy for.

public

F first(source: Array<T>): T

Will return first element from array.

public

F flatten(source: Array<T>): *

Flattens array.

public

F groupBy(args: ...any): object

Will group objects in array by given property, function or path.

public

F groupByFn(source: Array<object>, groupFn: Function): object

Will group objects in array by function.

public

F groupByPath(source: Array<object>, groupPath: *): object

Will group objects in array by object path.

public

F groupByProp(source: Array<object>, groupVal: string): object

Will group objects in array by property.

public

F head(source: Array<T>): T

Will return first element from array.

public

F last(source: Array<T>): T

Will return last element from array.

public

F map(source: Array<T>, fn: Function): Array<D>

Will project array object.

public

F nth(source: Array<T>, index: number): T

Will return element from array by given index.

public

F numAndStrComparator(first: string | number, second: string | number, prop: string): number

number or string comparator.

public

F pluck(source: Array<Object>, propName: string): Array<T>

Will return array of selected properties.

public

F reject(source: Array<T>, fn: Function): Array<T>

The opposite of filter; this method returns the elements of collection that predicate does not return truthy for.

public

F sample(source: Array<T>): T

Will return random element from array.

public

F shuffle(source: Array<T>): Array<T>

Will shuffle elements in array.

public

F some(source: Array<T>, fn: Function): boolean

Checks if predicate returns truthy for any element of collection.

public

F sortBy(source: Array<object>, propList: Array<string>): Array<object>

Sorts array of objects by given properties with priorities.

public

F tail(source: Array<T>): T

Will return last element from array.

public

F take(source: Array<T>, sourceLength: number): Array<T>

Will return first n elements.

public

F takeRight(source: Array<T>, numberOfLastElements: number): Array<T>

Will return last n elements from an array.

public

F takeRightWhile(source: Array<T>, rightWhileFn: Function): Array<T>

Creates a slice of array with elements taken from the end.

public

F takeWhile(source: Array<T>, whileFn: Function): Array<T>

Creates a slice of array with elements taken from the beginning.

public

F times(iterationNumber: number, fn: Function): Array<T>

Invokes the iteratee n times, returning an array of the results of each invocation.

public

F uniq(source: Array<any>): Array<any>

returns new array only with uniq elements

public

F without(source: Array<T>, matchItem: T): Array<T>

Returns an array without match item.

public

F zip(source: ...Array<T>): Array<D>

Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on.

public

Will zip multiple Arrays using projection function.

Constants

summary
public

V EMPTY: *

public
public
public
public
public
public
public
public
public
public
public

Context

summary
public

F invoke(fns: ...Function): object

Will invoke list of functions with given context.

public

F invokeWithCtx(ctx: object, fns: ...Function): void

Will invoke list of functions with given context in single invokation.

public

F using(ctx: object): object

Is opposite to invoke function.

public

F wrap(fn: Function, args: ...T): void

Will take function, arguments and return function that will invoke given function with given arguments.

Data-Structures

summary
public

Creates safe type tuple.

public

C Tuple

Tuple implementation.

Error

summary
public
public

Throws IncorrectArgsTypeError if at least one of conditions is positive.

Fantasy-Land

summary
public

F Either()

Either implementation.

public

F Left(value: any): Left

Left Implementation.

public

F Right(value: any): Right

Right Implementation.

public

F Applicative(f: any): Appicative

Appicative implementation.

public

F Apply(f: any): Apply

Apply implementation.

public

Functor implementation.

public

LazyFunctor implementation.

public

F Monad(x: any): Monad

Monad implementation.

public

F Just(value: any): Just

Just Implementation.

public

F Maybe()

Maybe implementation.

public

F Nothing(value: any): Nothing

Creates new Nothing.

public

Checks if passed object implements setoid.

public

F toSetoid(eqFn: Function): Setoid

Creates Setoid from given function.

Function

summary
public

F after(count: number, fn: Function): Function

Creates a function that invokes fn once it's called n or more times.

public

F compose(fns: ...Function): Function

This method is like pipe except that it creates a function that invokes the provided functions from right to left.

public

F curry(fn: Function): Function | T

Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining func arguments, and so on.

public

Creates a function that memoizes the result of fn.

public

F once(fn: Function): T | undefined

Creates a function that is restricted to invoking func once.

public

F orCurry(fn: Function, args: ArrayLike | Array<any>): Function | T

Creates curry variation of function if some of arguments are missed.

public

F partial(fn: Function, partialArgs: ...T): Function

Creates a function that invokes fn with partials prepended to the arguments it receives.

public

F pipe(fns: ...Function): Function

Creates a function that returns the result of invoking the provided f unctions with the this binding of the created function, where each successive invocation is supplied the return value of the previous.

public

F rearg(fn: Function, order: Array<number>): *

Reorginizes argument order.

public

Create funtion that makes same as passed function but newly created function will use only first argument.

Function-Combinators

summary
public

F alt(fn1: Function, fn2: Function): Function

This combinator takes two functions and returns the result of the first one if the value is defined (not false, null, or undefined); otherwise, it returns the result of the second function.

public

F always(value: T): Function

Creates function which will always return passed argument.

public

Takes function and invokes it with passed argument two times.

public

Takes function and changes argument order.

public

F fork(join: Function, fn1: Function, fn2: Function): Function

The fork combinator is useful in cases where you need to process a single resource in two different ways and then combine the results.

public

F identity(value: T): T

The identity combinator is a function that returns the same value it was provided as an argument.

public

F seq(fns: ...Function): Function

The seq combinator is used to loop over a sequence of functions.

public

Helps to check data in chain.

public

Takes argument and returns function which expects to get function which will be invoked with first argument.

Lens

summary
public

F assoc(propName: string, valueToBeSet: T, source: object): object

Makes a deep clone of an object, setting or overriding the specified property with the given value.

public

F assocPath(path: Array<String|Number>, valueToBeSet: any, source: Object | Array): Object | Array

Updates Array or Object by given path with given value.

public

F lensIndex(index: number, source: Array<T>): T

Returns value taken by index from source.

public

F lensProp(propName: string): Function

Returns a lens whose focus is the specified property.

public

F path(p: Array<string>, source: object): any

Retrieve the value at a given path.

public

F pathEq(path: Array<string>, source: object, value: any): any

Retrieve the value at a given path and compares it with given value.

public

F pathOr(path: Array<string>, source: object, orValue: any): any

Retrieve the value at a given path and if value is undefined returns orValue.

public

F pathSatisfies(path: Array<string>, source: object, satisfyFn: Function): any

Retrieve the value at a given path and returns result of invocation satisfy function with value by path.

public

F prop(propName: string, source: object): T

Returns value taken by property from source.

Math

summary
public

F add(augend: number, addendList: ...number): number

Adds numbers.

public

F compareDecimalNumbers(number1: number, number2: number): boolean

Compares two small decimal values.

public

F divide(dividend: number, divisorList: number): number

Divide numbers.

public

Will generate random integer.

public

Will generate random integer in passed range.

public

F multiply(multiplier: number, multiplicandList: number): number

Multiply numbers.

public

F subtract(minuend: number, subtrahendList: number): number

Subtract numbers.

Object

summary
public

F cloneObject(objectToClone: object): object

Will create object clone.

public

F conformsTo(object: object, predicateSetModel: object): boolean

Checks object properties with set of predicates.

public

F deepClone(objectToDeepClone: object): object

Will create an object deep clone.

public

F deepEquals(first: any, second: any): boolean

Compares two elements.

public

Will deep frezee all properties.

public

Curry version of get function that expects in future to get property list.

public

F getWithProps(props: ...string): Function

Curry version of get function that expects in future to get context.

public

F objectProjection(obj: object, cb: Function, skipCb: Function): Array<any>

Iterates by object properties.

public

F omit(source: object, omitArray: ...string): object

Will create and return a new object with omited properties from omitArray.

public

F pick(source: object, pickArray: ...string): object

Will create and return a new object with selected properties from pickArray.

public

F safeGet(obj: object, props: ...string): *

Implementation of optional chain operator.

public

F safeGetOr(obj: object, orValue: any, props: ...string): any

Implementation of optional chain operator.

Predicate

summary
public

F eq(elem1: T): Function

Checks if two elements are the same

public

F gt(number1: number): Function

Saves number1 and returns predicate function that will be checking if number2 is greater then number1.

public

F gte(number1: number): Function

Saves number1 and returns predicate function that will be checking if number2 is greater then or equal to number1.

public

F lt(number1: number): Function

Saves number1 and returns predicate function that will be checking if number2 is less then number1.

public

F lte(number1: number): Function

Saves number1 and returns predicate function that will be checking if number2 is less then or equal to number1.

public

F notEq(elem1: T): Function

Checks if two elements are not the same.

public

F range(number1: number, number2: number): Function

Saves number1, number2 and returns predicate function that will be checking if future passed number is in range of number1 and number2.

public

F rangeEqual(number1: number, number2: number): Function

Saves number1, number2 and returns predicate function that will be checking if future passed number is in range of number1 and number2 or equal to number1/number2.

Predicate-Combinator

summary
public

F and(predicates: ...Function): Function

Takes list of predicates and returns a one predicate, current predicate will return true only in case if all passed predicates return true.

public

F not(predicates: ...Function): Function

Takes list of predicates and returns a one predicate, current predicate will return true only in case if all passed predicates return false.

public

F notOr(predicates: ...Function): Function

Takes list of predicates and returns a one predicate, current predicate will return true only in the case if none of passed prdicates returns true.

public

F or(predicates: ...Function): Function

Takes list of predicates and returns a one predicate, current predicate will return true if at least one of passed predicates returns true.

String

summary
public

F buildResource(src: String, args: Array<T>): String

Works similarly to templates.

public

Converts string to camel case.

public

Will compare two strings with ignore case.

public

Will return first lower letter from source.

public

Will return first upper letter from source.

public

Will return last lower letter from source.

public

Will return last upper letter from source.

public

F includes(source: String, includement: String | number): boolean

Work similary to indexOf method but returns boolean.

public

Converts string to kebab case.

public

F replaceAll(replaceable: String, from: String, to: T): String

Will replace all occurrences.

public

F replaceAllDifferences(replaceable: String, fromList: Array<T>, to: Array<T>): String

Will replace all different occurrences.

public

Converts string to snake case.

public

F trim(stringSource: String): *

Removes leading and trailing whitespace or specified characters from string.

public

Will make a capital first letter.

public

F words(strValue: String): Array<String>

Splits string into an array of its words.

Type

summary
public

F getType(valToCheck: T): string

Checks type of passed value.

public

F getTypeByClass(clazz: T): string

Returns class name.

public

F isArray(valToCheck: T): boolean

Checks if passed value is Array.

public

F isBoolean(valToCheck: T): boolean

Checks if passed value is boolean.

public

F isDate(valToCheck: T): boolean

Checks if passed value is Date.

public

F isFunction(valToCheck: T): boolean

Checks if passed value is Function.

public

F isNaN(valToCheck: T): boolean

Checks if passed value is NaN.

public

F isNegativeZero(numberToCheck: number): boolean

Checks if passed value is negative zero.

public

F isNotArray(valToCheck: T): boolean

Checks if passed value is not Array.

public

F isNotBoolean(valToCheck: T): boolean

Checks if passed value is not boolean.

public

F isNotDate(valToCheck: T): boolean

Checks if passed value is not Date.

public

F isNotFunction(valToCheck: T): boolean

Checks if passed value is not Function.

public

F isNotNaN(valToCheck: T): boolean

Checks if passed value is not NaN.

public

F isNotNegativeZero(numberToCheck: number): boolean

Checks if passed value is not negative zero.

public

F isNotNull(valToCheck: T): boolean

Checks if passed value is not null.

public

F isNotNumber(valToCheck: T): boolean

Checks if passed value is not number.

public

F isNotObject(valToCheck: T): boolean

Checks if passed value is not Object.

public

F isNotPrimitive(value: T): boolean

Determine whether a value is not a primitive type.

public

F isNotRegExp(valToCheck: T): boolean

Checks if passed value is not RegExp.

public

F isNotString(valToCheck: T): boolean

Checks if passed value is not string.

public

F isNotSymbol(valToCheck: T): boolean

Checks if passed value is not Symbol.

public

F isNotUndefined(valToCheck: T): boolean

Checks if passed value is not undefined.

public

F isNull(valToCheck: T): boolean

Checks if passed value is null.

public

F isNumber(valToCheck: T): boolean

Checks if passed value is number.

public

F isObject(valToCheck: T): boolean

Checks if passed value is Object.

public

F isPrimitive(value: T): boolean

Determine whether a value is a primitive type.

public

F isRegExp(valToCheck: T): boolean

Checks if passed value is RegExp.

public

F isString(valToCheck: T): boolean

Checks if passed value is string.

public

F isSymbol(valToCheck: T): boolean

Checks if passed value is Symbol.

public

F isUndefined(valToCheck: T): boolean

Checks if passed value is undefined.

public

F notToBe(expectation: T): Function

Takes expectation and returns predicate function which will be checking if new passed variable not equal to expectation.

public

F toBe(expectation: T): Function

Takes expectation and returns predicate function which will be checking if new passed variable equal to expectation.

public

F typeCheck(clazz: T, actualType: any): any

Checks if type is correct and throws error in negative case.