Skip to content

ayshiff/102

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

79 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Build Status Coverage Status MIT licensed npm version

A modern functionnal programming library based on 101. (This library is still in developpment.)

Installation

Run npm install 102f

To add this npm package to your local machine, type the above into your command line.
You’ll notice a node_modules directory appear in your root where the package is now installed.

apply


apply.apply(fn, args)

Apply a function to an argument list.

Parameters

fn: function

args: array

Returns: any

Example:

let apply = require('102f/src/apply')
let arr = [0, 1, 2, 3]
apply(Math.max, arr) // 3

compose


compose.compose(f, g)

Performs right-to-left function composition.

Parameters

f: function

g: function

Returns: function

Example:

let compose = require('102f/src/compose')
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:

let multiply = require('102f/src/multiply')
var multiplyFunction = function(x,y) { return x * y }
var curried = curry(f)
curried(2)(3) //6

isEmpty


isEmpty.isEmpty(val)

Returns true if the parameter is empty.

Parameters

val: any

Returns: boolean

Example:

let isEmpty = require('102f/src/isEmpty')
var val = '';
isEmpty(val) // true

isInteger


isInteger.isInteger(val)

Returns true if the argument is an Integer.

Parameters

val: any

Returns: boolean

Example:

let isInteger = require('102f/src/isInteger')
var val = 15;
isInteger(val) // true

isNumber


isNumber.isNumber(val)

Returns true if the argument is a Number.

Parameters

val: any

Returns: boolean

Example:

let isNumber = require('102f/src/isNumber')
var val = 15.3;
isNumber(val)

map


map.map(f, array)

Parameters

f: function

array: Array

Returns: Array

Example:

let map = require('102f/src/map')
var array = [0,1,2,3]
var result = map(x => x * 2, array) //[0,2,4,6]

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:

let multiply = require('102f/src/multiply')
var a = 2
var b = 3
var result = multiply(a)(b) //6

newContainer


newContainer.newContainer(arg)

Returns a new Container

Parameters

arg: any

Returns: Container

Example:

let newContainer = require('102f/src/newContainer')
var Container1 = newContainer(2) //Container { _value: 2 }

About

πŸ“š A modern functional JS library based on 101

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published