Home Reference Source Test
public class | source

Functor

class Functor is the primitive class for composing higher functor based class. This class wrap Ramda for providing Functional programming style method.

Example:

import { Functor } from 'causal-net.core';

(async ()=>{
    let functor = new Functor();
    console.log(functor.range(10));
    console.log(functor.zeros(10));
    console.log(functor.ones(10));
})();

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

This method return core Ramda instance

Private Members
private

R: *

private

logger: *

Method Summary

Public Methods
public

enumerate(array: *): *

public

getIn(keys: Array , item: Object , defaultValue: Any ): Any

public

ones(range: *): *

public

range(size: Array ): [Array]

Return an array with the given range

public

setIn(keys: Array , value: Object , item: Object ): Any

set value into object by the keys list

public

unzip(pairs: Array ): [Array1, Array2]

Unzip array of pairs to two arrays

public

zeros(range: *): *

public

zip(pairs: Array ): Array

zip two array

Public Constructors

public constructor() source

Public Members

public get CoreFunctor: * source

This method return core Ramda instance

Private Members

private R: * source

private logger: * source

Public Methods

public enumerate(array: *): * source

Params:

NameTypeAttributeDescription
array *

Return:

*

public getIn(keys: Array , item: Object , defaultValue: Any ): Any source

Params:

NameTypeAttributeDescription
keys Array
item Object
defaultValue Any

return value in case of not found

Return:

Any

return found value or defaultValue

public ones(range: *): * source

Params:

NameTypeAttributeDescription
range *

Return:

*

public range(size: Array ): [Array] source

Return an array with the given range

Params:

NameTypeAttributeDescription
size Array

array of pairs to unzip

Return:

[Array]

arrays from [beginAt, ...size]

public setIn(keys: Array , value: Object , item: Object ): Any source

set value into object by the keys list

Params:

NameTypeAttributeDescription
keys Array
value Object
item Object

item to set

Return:

Any

return found value or defaultValue

public unzip(pairs: Array ): [Array1, Array2] source

Unzip array of pairs to two arrays

Params:

NameTypeAttributeDescription
pairs Array

array of pairs to unzip

Return:

[Array1, Array2]

two arrays

public zeros(range: *): * source

Params:

NameTypeAttributeDescription
range *

Return:

*

public zip(pairs: Array ): Array source

zip two array

Params:

NameTypeAttributeDescription
pairs Array

two arrays to zip

Return:

Array

array after zip