Home Reference Source

References

array

summary
public

F arrCMP(arr1: [sorted_elements], arr2: [sorted_elements]): integer

Compare array, assumes the arry is sorted returns -1, 0, +1 as required by a sotring compare function

public

F arrEQ(arr1: [elements], arr2: [elements], eqFn: Function): boolean

Tests array for equality

public

F FLATTEN(res: Array, arr: [type]): [type]

Use with a reducer

public

F flatten(arr: [with_inner_arra], level: integer): [type]

Flatten an array to a depth of level, for example if level = 1, only flatten at the top level (depath1)

public

F arrProd(list: [type]): [type]

array cross product in n dimension, where n ils the number of arguments (length of list) Note: this can produce enormous amounts of data for n > 1, for esample n = 2, list[0].length = x ,and list[1].length = y the resultant array contains x*y values, x = 100, y=200 we produce 20,000 values;

public

F reord(subListWithNewOrder: [type], fullList: [type]): [type]

private
public

V reord

array/arrayutils

summary
public

F arrConcat(arrays: Array): Array

concatinate a list of arrays

public

F arrCountVal(list: [type], v: [type]): [type]

[arrCountVal description]

public

F arrCurry(functionToDecorate: Function): Function

THis decorates and array function so that it can have one of two forms 1.

public

F arrDiff(arr1: Array, arr2: Array): Array

return the difference of two arrays same as arr1 xor arr2

public

F arrDistinct(arr1: [type], arr2: [type]): [type]

arrDistinct description, not array equal

public

F arrHash()

public

F arrIntersect(arr1: Array, arr2: Array): Array

return the intersection of two arrays

public

F arrOf(aVal: any, n: int32): Array

create an array of same values (aVal) where the result has n of those values

public

F arrRemove(arr: Array, listToRemove: Array): Array

array subtraction arr - listToRemove (return an array with all elements of arr this is not in listToRemove)

public

F arrSplit(n: int, arr: Array): Array

split an array into n more or less equal length arrays

public

F arrUnion(arr1: Array, arr2: Array): Array

return the union of two arrays

public

F arrZip(arrays: Aarry): Array

zip and array, given an array of columns (each element is a column of values) converts and array of column arrays to and array row arrays

public

F filterIX(fn: Function, arr: [any]): [integre]

filter an attar and return the index found

public

F last(arr: [type], defaultV: String): [type]

Get the last element of an array

public

F newArray(n: integer, v: value): Array

create a new array of length n

public

F redim(arr: [any], n: number): [type]

public

F safeDedup(list: Array): Array

[safeDedup description]

public

F setHash(arrOfInt: [int]): [type]

function to take the hash of an array of integers

public

F vecAdd(a1: [number], a2: [number]): [number]

Add two vectors

public

F xor(array1: [type], array2: [type]): [type]

remove all elements that are in both arrays

public

F dictToZip()

public
public

F zipToDict(aListOfPairs: [[string, any]]): [type]

public
public
public
public
public
public
public
public

V arrMax

public
public

V arrMin

public

V arrOf

public
public
public

V arrSum

public
public

V arrZip

public

V last

public
public

V redim

public
public

V vecAdd

public

V xor

array/intset

summary
public

F asSortedSet(array: [type]): [type]

converts an array to sorted set, pure function - does not modify the input

public

F dedupSortedArr(arr: [Array]): [Array]

removes all duplicates in a sorted array, pure function - does not modify the input

public

F findIndexOf(aSet: [Array], searchElement: [Any]): [Int]

find the index of an element is a sorted array representing a set, uses binary search

public

F hasNoDups(arr: [Array]): [Boolean]

checks if sorted array has no dups, pure function - does not modify the input

public

F intersect(sortedL: [Array]]): [Array]

intersection of a list of sets (sorted arrays) Intersects list sorted array sets (array that issorted and has no duplicates)

public

F intersectL(lsa: [Array]): [Array]

intersection of an Array of sets, where each Set is represented as a sorted array of values (no dups)

public

F isSorted(arr: [type]): [boolean]

checks if array is sorted, pure function - does not modify the input

public

F max(list: [any]): any

maximum of a sorted array

public

F range(start: [int32], end: [int32]): [Array]

Creates a set (array) of numbers [start ...

public

F similarity(sortedA: [Array], sortedB: [Array]): [Array]

Show how similar two sets (sorted list) actually are

public

F subtract(fromSet: [Array], elementsToRemove: [Array]): [Array]

Set subtraction: fromSet - elementsToRemove, assumes both sets are are represented by sorted array, and as per set definition there are no dups

public

F unionL(lsa: [Array]): [set]

Union of a list of sets: assumes both sets are are represented by sorted array, and as per set definition there are no dups

public
public
public
public
public
public
public
public

V max

public

V range

public
public
public

V unionL

dict

summary
private

dict/utils

summary
public

C Accum

public

Support one => many mapping

public
public

Dictionary to count the number of key value pairs, Note for any key we only support one value, if

public

F groupByToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type]

Returns an array of Frames, for each group the name of the Frameis the value of the grouping

public

F groupToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type]

[groupToDict description]

public

F zipTo()

public
public
public

V zipTo

frame

summary
public

Used to from the base class for a Frame, This is added to break circular import reference from hasFrame(aFrame) function Originally hasFrame imported frame and frame imported hasFrame.

public

C Frame

This pure data structure represent a database like table internally it consists of rows and columns representing a generalized 2d matrix You can also think of this like a limited excel sheet.

public

F arrToCol(arr: [type]): [type]

[arrToCol description]

public

F createAccesClass(columns: [type]): [type]

[createAccesClass description]

public

F genColIxFunc(aFrame: [type]): [type]

[genColIxFunc description]

public

F getColIx()

public

F groupBy(groupColsOrig: [type], aFrame: [type], accumList: [type]): [type]

The frame should already be sorted by the groupBy order, or

public

F haveFrame()

private

F _makeUnique(listOfRows: [column_elements], colIx: [type]): dict

public

F arrayUniq(list: [type]): [type]

[description]

public

F sortFrameBy(columnNames: [type], aFrame: [type], cmpFn: [type]): [type]

create a comparison function for a frame usage sortFrameBy(['+surname', 'givenName', '-age'], aFrame)

  • == ascending
  • == descending
public

F toHTML()

private
public
public

frame/frame-utils

summary
public

F coreFrameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame

Create a Frame from a string buffer (string reat from a file)

  • Lines are seperaed into columns using a 'splitter' supports

    • TSV : tab seperated columns - tsvLine
    • CSV : comma seperated values - csvLine
    • PSV : pipe (|) seperated values popular in healthcare - tsvLine

    Default splitter (tsvLine) is tab seperated values

public

F frameCount(aFrame: Frme, colName: string, convName: function): [string, number]

[frameCount description]

public

F frameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame

Create a Frame from a string buffer (string reat from a file)

  • Lines are seperaed into columns using a 'splitter' supports

    • TSV : tab seperated columns - tsvLine
    • CSV : comma seperated values - csvLine
    • PSV : pipe (|) seperated values popular in healthcare - tsvLine

    Default splitter (tsvLine) is tab seperated values

public

F frameSum(aFrame: Frme, colName: string, convName: function, convValue: function): [type]

[frameSum description]

public

F frameToString(aFrame: [type]): [type]

[frameToString description]

public

F frameWithIndex(aFrame: Frame, indexName: string, atEnd: boolean): Frame

[frameWithIndex description]

public

F transpose(frame: [type], pivot: [type]): [type]

[transpose description]

public

F unionFrame(frame1: Frame, frame2: Frame, notSorted: boolean): Frame

Creates a new frame from the union of the rows of the two frames, similar to s set union.

public
public
public
public
public
public
public
public

frame/groupby-utils

summary
public

F accStr()

public

F gbCount(name: [type], newName: [type]): [type]

gbCount count elemnts (non empty) in a group, bases on sql group by operation
e.g.

public

F gbMax(name: [type], newName: [type], fn: Function): [type]

gbMax max value in a group, see gbMin

public

F gbMean(name: string, newName: string, fn: function): [type]

gbMean average (mean) value of a group - see gbMin

public

F gbMerge(name: [type], newName: [type], sep: [type]): [type]

gbMerge merge the values grouped rows onto a single comma seperated value

public

F gbMergeU(name: [type], newName: [type], sep: [type]): [type]

[gbMergeU description]

public

F gbMin(name: [type], newName: [type], fn: Function): [type]

gbMin minimum elemnts value (non empty) in a group, bases on sql group by operation
e.g.

public

F gbStdDiv(name: [type], newName: [type]): [type]

gbStdDiv standard deviation - see gbMin

public

F gbSum(name: [type], newName: [type]): [type]

gbSum sum eelemnts in a group, bases on sql group by operation
e.g.

public

F gbVal(newName: [type], value: [type]): [type]

create a column with constant value

public

V accStr

public

V gb

public
public

V gbMax

public

V gbMean

public
public
public

V gbMin

public
public

V gbSum

public

V gbVal

frame/join-utils

summary
public

F changeNameTo(name: string, sep: string): [oldName, newName]

changeNameTo takes a change name description array of two elements containing the old names and the new names e.g oldName=newName 'a name change descriptor' where '=' is the seperator return an array of 2 strings [oldName, newName]

public

F colName(list: [string], colsNameList1: [string], colsNameList2: [string]): [[string],[string]]

colName(['1.DX=DX1', '2.DX=DX2', '1.FX=F1', ...], ['DX','FX',...],['DX',...])

public

F fullInnerJoin(frame1: Frame, frame2: Frame, projectList: [string], joinOn: string, filter: function): Frame

 example of a join
public

F getDict()

public

F getTransform(projectList: [string], cols1: [string], cols2: [string]): Object

Takes two column list (or one) and a mapping list and returns a transform function That will create a new row taking columns from each of the lists

public

F indexFrameColumn(aFrame: Frame, colName: String, noNull: boolean, dict: Object): Dict

Creates a index for a column (dictionary)

public

F innerJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame

innerJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter}

public

F joinOp(frame1: Frame, frame2: Frame, col1: string, col2: string, filter: function): function

returns a function that will perform an innet joint test

public

F leftJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame

leftJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter}

public
public

F matchIt(res: [type], row1: [type], arr: [type], cmp: [type], tr: [type]): [[row_element]

leftJoin on one row from left and arr from right

public

F outerJoin(frame1: [type], frame2: [type], projectList: [type], joinOn: [type], filter: [type]): [type]

[outerJoin description]

public

F project()

public
public
public
public
public
public
public
public
public
public

V joinOp

public
public
public

string

summary
private

string/csv

summary
public

F csvLine(line: string): [string]

converts a line representing comma separated values (CSV) into an array of strings

public

F dataSplit(data: [string], splitter: function, fn: function): [string]

Takes a array of string lines, representing a list of 'row' strings.

public

F psvLine(line: string): [string]

converts a line representing pipe (|) separated values (PSV) into an array of strings.

public

F trimListElements(arr: [string]): [string]

Takes an array of strings and trims all the strings in the array, modifies the input array and returns the same array with the trimed strings

public

F tsvLine(line: string): [string]

converts a line representing tab separated values (TSV) into an array of strings

public
public
public
public
public

string/strdict

summary
public

String Dictionary implememtation that minimizes the garbage created

public

F strEq(str: string, strStart: int32, strEnd: int32, otherStr: string): boolean

strEq str.substring(strStart,strEnd) === otherStr

public

F strHash(str: string, start: int32, end: int32): int32

Code taken from https://github.com/darkskyapp/string-hash, Too small to be worth is own module.

public

V strEq

public

string/strutil

summary
public

F countCh(data: string, char: char, arr: [int32], start: int32, end: int32): int32

count the number of occurences of char in the string

public

F padTo(padLength: number, padChar: char): function

Create a FUNCTION resturns padded (default is '0') string rep of a number

public

gets the prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be 'asse'

public

Find the length of the longest prefix of a and b string if a = pre + a1 and b = pre + b1 pre is the longet sting that satisfies the relationship i.e.

public

F prefixTail(a: String, b: String): [string]

Gets the non-prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be ['t', 'ss']

public

F prod(s: string | [string], list: [string]): [string]

This is rthe cross product of two arrays, where each arrys is an array of strings the result is and array of length m x n, where m is the length of the first vector and n is the length of the second vector

public

reverse a string

public

F strJoin(arrOfStrings: [String], sep: String): String

join an array of strings ignoring empty values

public
public

V padTo

public
public
public
public

V prod

public
public

utils

summary
public

F AND()

public

F FALSE()

public

F NOT()

public

F OR()

public

F TRUE()

public
public
public
public
public

V K

public
public
public
private
public

utils/objutils

summary
public

F filterDict(aDict: object, listOrFunc: [type]): Object

public

F fromKeyValueList(list: [type]): [type]

[fromKeyValueList description]

public

F fromKeyValueListV(list: [type]): [type]

[fromKeyValueListV description]

public

F genFilterFunction(aListOrStringOrEmpty: [string]): [type]

create a function that tests for elements in aListOrStringOrEmpty aListOrStringOrEmpty => undefined - allows everything aListOrStringOrEmpty => [...

public

F genObjMapper(obj: [type]): [mapperFunction, [keys]]

genObjMapper generates a function to map object to an array this is useful to convert an array of object to the data of a frame

public

F keys()

public
public

F pickRaw(list: String): function

Same as the pick(...) function withour memoizing

public

F setKey(obj: object, key: string, v: any): object

Set the vale of a key on an object and return the object

public

F setKeyV(obj: [type], key: [type], v: [type])

setKeyV - set object's key (multiple) value, if there is no value argument is present get the value list for the key

public

F shallow()

public

F toKeyValueList(obj: [type]): [type]

[toKeyValueList description]

public

F toKeyValueListV(obj: [type]): [type]

[toKeyValueListV description]

public

V access

public
public
public
public
public
public

V keys

public
public
public

V pick

public
public

V setKey

public
public
public
public
public

V isA

utils/sort-helper

summary
public

F cmpNumOrStrBy(colIX: [type]): function

comapre string or number (used to sort frames)

public

F cmpStr(a: string, b: string): int32

Compare two strings (for sorting) 0 == euqal, -1 a<b, 1 a>b

public

F cmpStrNum(a: string | number, b: string | number): int32

cmpStrNum compare (number, number), or (number, string-of-number) or (string-of-number, number) (string-of-number, string-of-number) , (string, string)

public

F combineCmp(funcs: ...[type]): [type]

combine a set of sorting comparison functions so tht the sort presidence is maintained

public

Reverses a sort compare function so it sorts in descending order

public

F toNumber(str: [type]): [type]

Convert a string to a Javascript number, thakes into accont number string with commas (,) and numbers

public
public
public

V revCmp

utils/types

summary
public

F isArray(arr: any): boolean

is the arr/object an array

public

F isEmpty(arrOrObj: [Any]): [Boolean]

Check if an array is empty or an object has no attributes

public

F isFunction(fun: any): boolean

is obj a function

public

is str a string

public
public
public
public