Home Reference Source

Function

Static Public Summary
public

compose(funcs: ...Function): Function

Composes the functions right-to-left.

public

flatten(array: Array): Array

Flattens array a single level deep.

public

flow(funcs: ...Function): Function

Composes the functions left-to-right.

public

Converts string to upper case.

Static Public

public compose(funcs: ...Function): Function source

import compose from 'remram/src/function/compose.js'

Composes the functions right-to-left.

Params:

NameTypeAttributeDescription
funcs ...Function

The functions to compose.

Return:

Function

The composed (right-to-left) function.

Example:


const inc = value => value + 1
const double = value => value * 2
const incAndDouble = compose(double, inc)

incAndDouble(1)
// => 4

public flatten(array: Array): Array source

import flatten from 'remram/src/array/flatten.js'

Flattens array a single level deep.

Params:

NameTypeAttributeDescription
array Array

The array to flatten.

Return:

Array

Returns the new flattened array.

Example:


flatten([1, [2, [3]]])
// => [1, 2, [3]]

public flow(funcs: ...Function): Function source

import flow from 'remram/src/function/flow.js'

Composes the functions left-to-right.

Params:

NameTypeAttributeDescription
funcs ...Function

The functions to compose.

Return:

Function

The composed (left-to-right) function.

Example:


const inc = value => value + 1
const double = value => value * 2
const incAndDouble = flow(inc, double)

incAndDouble(1)
// => 4

public upperCase(text: String): String source

import upperCase from 'remram/src/string/upperCase.js'

Converts string to upper case.

Params:

NameTypeAttributeDescription
text String

The text to converts.

Return:

String

Returns the converted text.

Example:


upperCase('test')
// => 'TEST'