jsPlatform

Methods

static concat(functor) → {*|Array|Object}

Concats/appends all functors onto the end of first functor. Note: functors passed in after the first one must be of the same type.
Parameters:
Name Type Description
functor Array | Object | *
...functor Array | Object | *
Throws:
- When passed in object doesn't have an `every` method.
Type
Error
Returns:
* | Array | Object - - The type passed.

static every(fn, functor) → {*|Array|Object}

Returns `true` if `fn` (predicate) returns true for all items in functor else returns `false`.
Parameters:
Name Type Description
fn function Predicate.
functor Array | Object | *
Throws:
- When passed in object doesn't have an `every` method.
Type
Error
Returns:
* | Array | Object - - The type passed.

static filter(fn, functor) → {Array|Object}

Filters a functor (list etc.) with passed in function.
Parameters:
Name Type Description
fn function
functor Array | Object
Returns:
Array | Object

static forEach(fn, functor) → {*|Array|Object}

For each on functor (Array|Object|etc.).
Parameters:
Name Type Description
fn function
functor Array | Object | *
Throws:
- When passed in functor doesn't have a `forEach` method.
Type
Error
Returns:
* | Array | Object - - The type of object you pass in unless it doesn't have a `forEach` method.

static join(separator, arr) → {String}

Array.prototype.join
Parameters:
Name Type Description
separator String | RegExp
arr Array
Returns:
String

static map(fn, functor) → {Array|Object}

Maps a function to functor (list etc.).
Parameters:
Name Type Description
fn function
functor Array | Object
Returns:
Array | Object

static push(item, arr) → {Number}

Same as Array.prototype.push
Parameters:
Name Type Description
item *
arr Array
Returns:
Number

static reduce(fn, functor) → {Array|Object}

Reduces a foldable (list etc.) with passed in function.
Parameters:
Name Type Description
fn function
functor Array | Object
Returns:
Array | Object

static reduceRight(fn, functor) → {Array|Object}

Reduces a foldable (list etc.) from the right with passed in function.
Parameters:
Name Type Description
fn function
functor Array | Object
Returns:
Array | Object

static reverse(x) → {Array}

Reverses an list (shimmed if not exists).
Parameters:
Name Type Description
x Array.<any>
Returns:
Array

static split(separator, str) → {Array}

Functional version of `String.prototype.split`.
Parameters:
Name Type Description
separator String | RegExp
str String
Returns:
Array