102
![Build Status](https://travis-ci.org/ayshiff/102.svg?branch=master)
A modern functionnal programming library based on 101.
(This library is still in developpment.)
apply
apply.apply(fn, args)
Apply a function to an argument list.
Parameters
fn: function
args: array
Returns: any
Example:
let arr = [0, 1, 2, 3]
apply(Math.max, arr)
compose
compose.compose(f, g)
Performs right-to-left function composition.
Parameters
f: function
g: function
Returns: function
Example:
var f = function(x){ return x * x}
var g = function(x){ return x + 2}
let composed = compose(f,g)
curry
curry.curry(f)
Returns a curried equivalent of the provided function.
Parameters
f: function
Returns: function
Example:
var multiplyFunction = function(x,y) { return x * y }
var curried = curry(f)
curried(2)(3)
isEmpty
isEmpty.isEmpty(val)
Returns true if the parameter is empty.
Parameters
val: any
Returns: boolean
Example:
var val = '';
isEmpty(val)
isInteger
isInteger.isInteger(val)
Returns true if the argument is an Integer.
Parameters
val: any
Returns: boolean
Example:
var val = 15;
isInteger(val)
isNumber
isNumber.isNumber(val)
Returns true if the argument is a Number.
Parameters
val: any
Returns: boolean
Example:
var val = 15.3;
isNumber(val)
map
map.map(f, array)
Parameters
f: function
array: Array
Returns: Array
Example:
var array = [0,1,2,3]
var result = map(x => x * 2, array)
mapFunctor
mapFunctor.mapFunctor()
Returns a new Functor.
Returns: Container
multiply
multiply.multiply(a, b)
Returns the multiplication of two Numbers.
Parameters
a: Number
b: Number
Returns: Number
Example:
var a = 2
var b = 3
var result = multiply(a)(b)
newContainer
newContainer.newContainer(arg)
Returns a new Container
Parameters
arg: any
Returns: Container
Example:
var Container1 = newContainer(2)