import { FrequencyValueEquals , FrequencyValueEvery , FrequencyValueOneOf } from "./Frequency" ; /**
 * The class which contains commonly used functions by the library. These
 * functions and variables exist in a class so they may be overridden if
 * desired.
 */ export class Functions { param input returns public static isArray < T > ( input ) { return input instanceof Array ; } param x param y returns public static isArrayEquals ( x , y ) { if ( x === y ) return true ; if ( x . length !== y . length ) return false ; for ( let i = 0 ; i < x . length ; i ++ ) { if ( x [ i ] !== y [ i ] ) { return false ; } } return true ; } param input returns public static isString ( input ) { return typeof ( input ) === 'string' ; } param input returns public static isNumber ( input ) { return isFinite ( input ) && typeof input === 'number' ; } param input returns public static isObject < T extends object > ( input ) { return input !== null && ! this . isArray ( input ) && typeof ( input ) === 'object' ; } param input return public static isDefined < T > ( input ) { return typeof ( input ) !== 'undefined' ; } param input return public static isValue < T > ( input ) { return input !== null && typeof ( input ) !== 'undefined' ; } param input returns public static isFrequencyValueEvery ( input ) { return this . isObject < FrequencyValueEvery > ( input ) && this . isNumber ( input . every ) ; } param input returns public static isFrequencyValueOneOf ( input ) { return this . isArray ( input ) && input . length > 0 ; } param input returns public static isFrequencyValueEquals ( input ) { return typeof input === 'number' && isFinite ( input ) ; } param a param b returns see public static coalesce ( a , b , c ? ) { return this . isDefined ( a ) ? a : ( this . isDefined ( b ) ? b : c ) ; } param target param from returns public static extend < T = { [ prop ] : any ; } > ( target , from ) { for ( const prop in from ) { target [ prop ] = from [ prop ] ; } return target ; } param x param length param padding param before returns public static pad ( x , length , padding , before ) { while ( x . length < length ) { before ? x = padding + x : x = x + padding ; } return x ; } param x param length param first returns public static padNumber ( x , length , first = length ) { return this . pad ( x + '' , length , '0' , true ) . substring ( 0 , first ) ; } }