Home Reference Source

Function

Static Public Summary
public

Return an empty function

public

addClass(ele: DOMElement, cls: String)

Adds the specified class to the passed element

public

addEvt(obj: DOMElement, type: String, Handler: Function, capture: Boolean)

Add event handler for specified event on passed element

public

cancelEvt(evt: Event)

Cancels the event if it is cancelable, without stopping further propagation of the event.

public

contains(term: String, data: String, exactMatch: Boolean, caseSensitive: Boolean, ignoreDiacritics: Boolean): Boolean

Checks if passed data contains the searched term

public

createCheckItem(id: String, chkValue: String, labelText: String, extraAttr: Array): Object

Creates and returns a checklist item

public

Creates an html element with given collection of attributes

public

createOpt(text: String, value: String, isSel: Boolean): Object

Creates and returns an option element

public

Returns a text node with given text

public

dateSortAsc(First: Date, Second: Date): Number

Compare function for sorting passed dates in ascending manner according to the corresponding UTC numeric value (returned by getTime)

public

dateSortDesc(First: Date, Second: Date): Number

Compare function for sorting passed dates in descending manner according to the corresponding UTC numeric value (returned by getTime)

public

defaultsArr(value: Array | Any, default: Array): Array | Any

If passed value is not of array type return the default value otherwise return the value itself

public

defaultsBool(value: Boolean | Any, default: Boolean): Boolean | Any

If passed value is not of boolean type return the default value otherwise return the value itself

public

defaultsFn(value: Function | Any, default: Function): Function | Any

If passed value is not of function type return the default value otherwise return the value itself

public

defaultsNb(value: Number | Any, default: Number): Number | Any

If passed value is not of number type return the default value otherwise return the value itself

public

defaultsStr(value: String | Any, default: String): String | Any

If passed value is not of string type return the default value otherwise return the value itself

public

elm(id: String): DOMElement

Returns the element matching the supplied Id

public

getFirstTextNode(node: NodeElement): String

Returns the first text node contained in the supplied node

public

getText(node: NodeElement): String

Returns text + text of children of given node

public

has(arr: Array, val: Any, caseSensitive: Boolean): Boolean

Checks if given item can be found in the passed collection

public

hasClass(ele: DOMElement, cls: String): Boolean

Determine whether the passed elements is assigned the given class

public

Checks if browser has onhashchange event

public

hasStorage(): *

Checks if browser has Storage feature

public

ignoreCase(First: String, Second: String): Number

Case insensitive compare function for passed strings

public

Check passed argument is an array

public

Check passed argument is a boolean

public

isEmpty(obj: Any): Boolean

Check passed argument is empty (undefined, null or empty string)

public

Checks if passed string is empty

public

Check passed argument is a function

public

isKeyPressed(evt: Event, keyCodes: Array): *

Check code of pressed key is one of the expected key codes

public

isNull(obj: Any): Boolean

Check passed argument is null

public

Check passed argument is a number

public

Check passed argument is an object

public

Check passed argument is a string

public

isUndef(obj: Any): Boolean

Check passed argument is undefined

public

keyCode(evt: Event): Number

Returns the Unicode value of pressed key

public

Returns passed string as lowercase if caseSensitive flag set false.

public

numSortAsc(First: Number, Second: Number): Number

Compare function for sorting passed numbers in ascending manner

public

numSortDesc(First: Number, Second: Number): Number

Compare function for sorting passed numbers in descending manner

public

parse(Formatted: String, Decimal: String): Number

Takes a string, removes all formatting/cruft and returns the raw float value

public

removeClass(ele: DOMElement, cls: String)

Removes the specified class to the passed element

public

removeElm(node: DOMElement): DOMElement

Removes passed node from DOM

public

removeEvt(obj: DOMElement, type: String, Handler: Function, capture: Boolean)

Remove event handler for specified event on passed element

public

rgxEsc(text: String): String

Makes regex safe string by escaping special characters from passed string

public

sortDateStr(Compare: Function, locale: String): Function

Curried compare function for sorting passed formatted dates in desired fashion according to supplied compare function and locale

public

sortNumberStr(Compare: Function, decimal: String): Function

Curried compare function for sorting passed formatted numbers in desired fashion according to supplied compare function and decimal separator

public

stopEvt(evt: Event)

Prevents further propagation of the current event in the bubbling phase

public

tag(tagname: String): NodeList

Returns list of element matching the supplied tag name

public

targetEvt(evt: Event): DOMElement

Reference to the object that dispatched the event

public

trim(text: String): String

Removes whitespace from both sides of passed string

Static Public

public EMPTY_FN(): Function source

import {EMPTY_FN} from 'tablefilter/src/types.js'

Return an empty function

Return:

Function

public addClass(ele: DOMElement, cls: String) source

import {addClass} from 'tablefilter/src/dom.js'

Adds the specified class to the passed element

Params:

NameTypeAttributeDescription
ele DOMElement

DOM element

cls String

CSS class name

public addEvt(obj: DOMElement, type: String, Handler: Function, capture: Boolean) source

import {addEvt} from 'tablefilter/src/event.js'

Add event handler for specified event on passed element

Params:

NameTypeAttributeDescription
obj DOMElement

Element

type String

Event type

Handler Function
capture Boolean

Specifiy whether the event should be executed in the capturing or in the bubbling phase

public cancelEvt(evt: Event) source

import {cancelEvt} from 'tablefilter/src/event.js'

Cancels the event if it is cancelable, without stopping further propagation of the event.

Params:

NameTypeAttributeDescription
evt Event

Event on the DOM

public contains(term: String, data: String, exactMatch: Boolean, caseSensitive: Boolean, ignoreDiacritics: Boolean): Boolean source

import {contains} from 'tablefilter/src/string.js'

Checks if passed data contains the searched term

Params:

NameTypeAttributeDescription
term String

Searched term

data String

Data string

exactMatch Boolean

Exact match

caseSensitive Boolean

Case sensitive

ignoreDiacritics Boolean

Ignore diacritics

Return:

Boolean

public createCheckItem(id: String, chkValue: String, labelText: String, extraAttr: Array): Object source

import {createCheckItem} from 'tablefilter/src/dom.js'

Creates and returns a checklist item

Params:

NameTypeAttributeDescription
id String

index of check item

chkValue String

check item value

labelText String

check item label text

extraAttr Array

array containing attribute name and its value

Return:

Object

li DOM element

public createElm(tag: String, an: Array): Object source

import {createElm} from 'tablefilter/src/dom.js'

Creates an html element with given collection of attributes

Params:

NameTypeAttributeDescription
tag String

a string of the html tag to create

an Array

undetermined number of arrays containing the with 2 items, the attribute name and its value ['id','myId']

Return:

Object

created element

public createOpt(text: String, value: String, isSel: Boolean): Object source

import {createOpt} from 'tablefilter/src/dom.js'

Creates and returns an option element

Params:

NameTypeAttributeDescription
text String

option text

value String

option value

isSel Boolean

whether option is selected

Return:

Object

option element

public createText(txt: String): Object source

import {createText} from 'tablefilter/src/dom.js'

Returns a text node with given text

Params:

NameTypeAttributeDescription
txt String

Return:

Object

public dateSortAsc(First: Date, Second: Date): Number source

import {dateSortAsc} from 'tablefilter/src/sort.js'

Compare function for sorting passed dates in ascending manner according to the corresponding UTC numeric value (returned by getTime)

Params:

NameTypeAttributeDescription
First Date

date object

Second Date

date object

Return:

Number

Negative, zero or positive number

public dateSortDesc(First: Date, Second: Date): Number source

import {dateSortDesc} from 'tablefilter/src/sort.js'

Compare function for sorting passed dates in descending manner according to the corresponding UTC numeric value (returned by getTime)

Params:

NameTypeAttributeDescription
First Date

date object

Second Date

date object

Return:

Number

Negative, zero or positive number

public defaultsArr(value: Array | Any, default: Array): Array | Any source

import {defaultsArr} from 'tablefilter/src/settings.js'

If passed value is not of array type return the default value otherwise return the value itself

Params:

NameTypeAttributeDescription
value Array | Any
default Array

value

Return:

Array | Any

public defaultsBool(value: Boolean | Any, default: Boolean): Boolean | Any source

import {defaultsBool} from 'tablefilter/src/settings.js'

If passed value is not of boolean type return the default value otherwise return the value itself

Params:

NameTypeAttributeDescription
value Boolean | Any
default Boolean

value

Return:

Boolean | Any

public defaultsFn(value: Function | Any, default: Function): Function | Any source

import {defaultsFn} from 'tablefilter/src/settings.js'

If passed value is not of function type return the default value otherwise return the value itself

Params:

NameTypeAttributeDescription
value Function | Any
default Function

value

Return:

Function | Any

public defaultsNb(value: Number | Any, default: Number): Number | Any source

import {defaultsNb} from 'tablefilter/src/settings.js'

If passed value is not of number type return the default value otherwise return the value itself

Params:

NameTypeAttributeDescription
value Number | Any
default Number

value

Return:

Number | Any

public defaultsStr(value: String | Any, default: String): String | Any source

import {defaultsStr} from 'tablefilter/src/settings.js'

If passed value is not of string type return the default value otherwise return the value itself

Params:

NameTypeAttributeDescription
value String | Any
default String

value

Return:

String | Any

public elm(id: String): DOMElement source

import {elm} from 'tablefilter/src/dom.js'

Returns the element matching the supplied Id

Params:

NameTypeAttributeDescription
id String

Element identifier

Return:

DOMElement

public getFirstTextNode(node: NodeElement): String source

import {getFirstTextNode} from 'tablefilter/src/dom.js'

Returns the first text node contained in the supplied node

Params:

NameTypeAttributeDescription
node NodeElement

node

Return:

String

public getText(node: NodeElement): String source

import {getText} from 'tablefilter/src/dom.js'

Returns text + text of children of given node

Params:

NameTypeAttributeDescription
node NodeElement

Return:

String

public has(arr: Array, val: Any, caseSensitive: Boolean): Boolean source

import {has} from 'tablefilter/src/array.js'

Checks if given item can be found in the passed collection

Params:

NameTypeAttributeDescription
arr Array

collection

val Any

item to search

caseSensitive Boolean

respects case if true

Return:

Boolean

public hasClass(ele: DOMElement, cls: String): Boolean source

import {hasClass} from 'tablefilter/src/dom.js'

Determine whether the passed elements is assigned the given class

Params:

NameTypeAttributeDescription
ele DOMElement

DOM element

cls String

CSS class name

Return:

Boolean

public hasHashChange(): * source

import {hasHashChange} from 'tablefilter/src/modules/hash.js'

Checks if browser has onhashchange event

Return:

*

public hasStorage(): * source

import {hasStorage} from 'tablefilter/src/modules/storage.js'

Checks if browser has Storage feature

Return:

*

public ignoreCase(First: String, Second: String): Number source

import {ignoreCase} from 'tablefilter/src/sort.js'

Case insensitive compare function for passed strings

Params:

NameTypeAttributeDescription
First String

string

Second String

string

Return:

Number

1 if first string lower than second one 0 if first string same order as second one 1 if first string greater than second one

public isArray(obj: Array): Boolean source

import {isArray} from 'tablefilter/src/types.js'

Check passed argument is an array

Params:

NameTypeAttributeDescription
obj Array

Return:

Boolean

public isBoolean(obj: Boolean): Boolean source

import {isBoolean} from 'tablefilter/src/types.js'

Check passed argument is a boolean

Params:

NameTypeAttributeDescription
obj Boolean

Return:

Boolean

public isEmpty(obj: Any): Boolean source

import {isEmpty} from 'tablefilter/src/types.js'

Check passed argument is empty (undefined, null or empty string)

Params:

NameTypeAttributeDescription
obj Any

Return:

Boolean

public isEmpty(text: String): Boolean source

import {isEmpty} from 'tablefilter/src/string.js'

Checks if passed string is empty

Params:

NameTypeAttributeDescription
text String

Return:

Boolean

public isFn(obj: Function): Boolean source

import {isFn} from 'tablefilter/src/types.js'

Check passed argument is a function

Params:

NameTypeAttributeDescription
obj Function

Return:

Boolean

public isKeyPressed(evt: Event, keyCodes: Array): * source

import {isKeyPressed} from 'tablefilter/src/event.js'

Check code of pressed key is one of the expected key codes

Params:

NameTypeAttributeDescription
evt Event

key event

keyCodes Array

list of keycodes to check

Return:

*

public isNull(obj: Any): Boolean source

import {isNull} from 'tablefilter/src/types.js'

Check passed argument is null

Params:

NameTypeAttributeDescription
obj Any

Return:

Boolean

public isNumber(obj: Number): Boolean source

import {isNumber} from 'tablefilter/src/types.js'

Check passed argument is a number

Params:

NameTypeAttributeDescription
obj Number

Return:

Boolean

public isObj(obj: Object): Boolean source

import {isObj} from 'tablefilter/src/types.js'

Check passed argument is an object

Params:

NameTypeAttributeDescription
obj Object

Return:

Boolean

public isString(obj: String): Boolean source

import {isString} from 'tablefilter/src/types.js'

Check passed argument is a string

Params:

NameTypeAttributeDescription
obj String

obj

Return:

Boolean

public isUndef(obj: Any): Boolean source

import {isUndef} from 'tablefilter/src/types.js'

Check passed argument is undefined

Params:

NameTypeAttributeDescription
obj Any

Return:

Boolean

public keyCode(evt: Event): Number source

import {keyCode} from 'tablefilter/src/event.js'

Returns the Unicode value of pressed key

Params:

NameTypeAttributeDescription
evt Event

Event on the DOM

Return:

Number

public matchCase(text: String): String source

import {matchCase} from 'tablefilter/src/string.js'

Returns passed string as lowercase if caseSensitive flag set false. By default it returns the string with no casing changes.

Params:

NameTypeAttributeDescription
text String

Return:

String

string

public numSortAsc(First: Number, Second: Number): Number source

import {numSortAsc} from 'tablefilter/src/sort.js'

Compare function for sorting passed numbers in ascending manner

Params:

NameTypeAttributeDescription
First Number

number

Second Number

number

Return:

Number

Negative, zero or positive number

public numSortDesc(First: Number, Second: Number): Number source

import {numSortDesc} from 'tablefilter/src/sort.js'

Compare function for sorting passed numbers in descending manner

Params:

NameTypeAttributeDescription
First Number

number

Second Number

number

Return:

Number

Negative, zero or positive number

public parse(Formatted: String, Decimal: String): Number source

import {parse} from 'tablefilter/src/number.js'

Takes a string, removes all formatting/cruft and returns the raw float value

Params:

NameTypeAttributeDescription
Formatted String

number

Decimal String

type '.' or ','

public removeClass(ele: DOMElement, cls: String) source

import {removeClass} from 'tablefilter/src/dom.js'

Removes the specified class to the passed element

Params:

NameTypeAttributeDescription
ele DOMElement

DOM element

cls String

CSS class name

public removeElm(node: DOMElement): DOMElement source

import {removeElm} from 'tablefilter/src/dom.js'

Removes passed node from DOM

Params:

NameTypeAttributeDescription
node DOMElement

Return:

DOMElement

old node reference

public removeEvt(obj: DOMElement, type: String, Handler: Function, capture: Boolean) source

import {removeEvt} from 'tablefilter/src/event.js'

Remove event handler for specified event on passed element

Params:

NameTypeAttributeDescription
obj DOMElement

Element

type String

Event type

Handler Function
capture Boolean

Specifiy whether the event should be executed in the capturing or in the bubbling phase

public rgxEsc(text: String): String source

import {rgxEsc} from 'tablefilter/src/string.js'

Makes regex safe string by escaping special characters from passed string

Params:

NameTypeAttributeDescription
text String

Return:

String

escaped string

public sortDateStr(Compare: Function, locale: String): Function source

import {sortDateStr} from 'tablefilter/src/sort.js'

Curried compare function for sorting passed formatted dates in desired fashion according to supplied compare function and locale

Params:

NameTypeAttributeDescription
Compare Function

function

locale String
  • optional
  • default: 'en-us'

Locale code

Return:

Function

Compare function receiving parsed date arguments

public sortNumberStr(Compare: Function, decimal: String): Function source

import {sortNumberStr} from 'tablefilter/src/sort.js'

Curried compare function for sorting passed formatted numbers in desired fashion according to supplied compare function and decimal separator

Params:

NameTypeAttributeDescription
Compare Function

function

decimal String
  • optional
  • default: ','

Decimal separator

Return:

Function

Compare function receiving parsed numeric arguments

public stopEvt(evt: Event) source

import {stopEvt} from 'tablefilter/src/event.js'

Prevents further propagation of the current event in the bubbling phase

Params:

NameTypeAttributeDescription
evt Event

Event on the DOM

public tag(tagname: String): NodeList source

import {tag} from 'tablefilter/src/dom.js'

Returns list of element matching the supplied tag name

Params:

NameTypeAttributeDescription
tagname String

Tag name

Return:

NodeList

public targetEvt(evt: Event): DOMElement source

import {targetEvt} from 'tablefilter/src/event.js'

Reference to the object that dispatched the event

Params:

NameTypeAttributeDescription
evt Event

Event on the DOM

Return:

DOMElement

public trim(text: String): String source

import {trim} from 'tablefilter/src/string.js'

Removes whitespace from both sides of passed string

Params:

NameTypeAttributeDescription
text String

Return:

String