Index
- areCompatibleDataTypes
- assign
- assignDeep
- combinePath
- convertValue
- copyArrayTo
- createArrayFrom
- dateTimeToStr
- fillArray
- findItemById
- findItemIndexById
- generateId
- getIfDefined
- indexOfArrayItem
- isIntType
- isNumeric
- isNumericType
- isObject
- isPropSet
- linkTypeToStr
- moveArrayItem
- numberToStr
- parseOperatorFormat
- removeArrayItem
- shiftToFitWindow
- strToDate
- strToLinkType
areCompatibleDataTypes
Returns true
if two data types passed in parameters
are compatible - so it's safe to copy the values between
two expressions with these two types
▸ areCompatibleDataTypes(type1: DataType,type2: DataType): boolean
Parameters:
Returns boolean
assign
Copy the content of all objests passed in args
parameters into target
and returns the result
NB: This function copies only the first level properties.
For a deep copy please use assignDeep
▸ assign(target: any
,args: any
[]): any
Parameters:
- target:
any
- the target object - args:
any
[] - an array of the source objects
Returns any
assignDeep
Copy the content of all objests passed in args
parameters into target
and returns the result
NB: This function make a deep copy -
so assignDeep
will be called recursively for all object properties
on the first level.
▸ assignDeep(target: any
,args: any
[]): any
Parameters:
- target:
any
- the target object - args:
any
[] - an array of the source objects
Returns any
combinePath
Adds two paths and returns the result Correctly processes leading and trailing slashes
▸ combinePath(path1: string
,path2: string
): string
Parameters:
- path1:
string
- path2:
string
-
Returns string
convertValue
▸ convertValue(value: string
,fromDataType: DataType,toDataType: DataType): string
Parameters:
Returns string
copyArrayTo
▸ copyArrayTo(collection1: any
,collection2: any
): void
Parameters:
- collection1:
any
- collection2:
any
Returns void
createArrayFrom
▸ createArrayFrom(collection: any
): any
Parameters:
- collection:
any
Returns any
dateTimeToStr
▸ dateTimeToStr(date: Date
,format: string
): string
Parameters:
- date:
Date
- format:
string
Returns string
fillArray
▸ fillArray(arr: Array
<T
>,value: T
,start?: number
,end?: number
): T
[]
Parameters:
- arr:
Array
<T
> - value:
T
- start:
number
, Default value =0
- end:
number
, Optional
Returns T
[]
findItemById
Searches an array of the objects which implement ItemWithId by ID Returs the found object or null.
▸ findItemById(array: Array
<T
>,id: any
): T
Parameters:
- array:
Array
<T
> - id:
any
-
Returns T
findItemIndexById
▸ findItemIndexById(array: Array
<T
>,id: any
): number
Parameters:
- array:
Array
<T
> - id:
any
Returns number
generateId
Generates an unique ID
▸ generateId(prefix: string
): string
Parameters:
- prefix:
string
Returns string
getIfDefined
▸ getIfDefined(value: T
,defaultValue: T
): T
Parameters:
- value:
T
- defaultValue:
T
Returns T
indexOfArrayItem
Searches an array of the objects which implement ItemWithId by ID Returs the index of the found element, or -1 if nothing was found.
▸ indexOfArrayItem(arr: Array
<T
>,item: T
): number
Parameters:
- arr:
Array
<T
> - item:
T
Returns number
isIntType
Returns true
if the DataType
value passed in the parameter
represents some numeric type
▸ isIntType(dtype: DataType): boolean
Parameters:
- dtype: DataType -
Returns boolean
isNumeric
Returns true
if the value passed in the parameter is an a numeric value
▸ isNumeric(val: any
): boolean
Parameters:
- val:
any
-
Returns boolean
isNumericType
Returns true
if the DataType
value passed in the parameter
represents some numeric type
▸ isNumericType(dtype: DataType): boolean
Parameters:
- dtype: DataType -
Returns boolean
isObject
Returns true
if the value passed in the parameter is an object
▸ isObject(val: any
): boolean
Parameters:
- val:
any
-
Returns boolean
isPropSet
Returns true
if the property with named propName
in the object obj
has some value
▸ isPropSet(obj: any
,propName: any
): any
Parameters:
- obj:
any
- propName:
any
-
Returns any
linkTypeToStr
Converts a LinkType
value to a string
▸ linkTypeToStr(type: LinkType): string
Parameters:
- type: LinkType -
Returns string
moveArrayItem
Moves an item in some array to a new position
▸ moveArrayItem(array: Array
<T
>,index1: number
,index2: number
): void
Parameters:
- array:
Array
<T
> - index1:
number
- index2:
number
-
Returns void
numberToStr
▸ numberToStr(number: Number
,decimalSeparator?: string
): string
Parameters:
- number:
Number
- decimalSeparator:
string
, Optional
Returns string
parseOperatorFormat
Parses the operator's format string and returns a list of tokens
▸ parseOperatorFormat(operator: any
): FormatToken[]
Parameters:
- operator:
any
-
Returns FormatToken[]
removeArrayItem
Searches for a particular item in the array are removes that item if found.
▸ removeArrayItem(arr: Array
<T
>,value: T
): T
Parameters:
- arr:
Array
<T
> - value:
T
-
Returns T
shiftToFitWindow
Calculates the shift on which we need to move our element horizontally to find current window
▸ shiftToFitWindow(absLeft: number
,width: number
): number
Parameters:
- absLeft:
number
- width:
number
-
Returns number
strToDate
▸ strToDate(value: string
,format: string
): Date
Parameters:
- value:
string
- format:
string
Returns Date
strToLinkType
Converts a string to a LinkType
value
▸ strToLinkType(str: string
): LinkType
Parameters:
- str:
string
-
Returns LinkType