Functions
- IsDefinedAndNotNull
- areCompatibleDataTypes
- assign
- assignDeep
- copyArrayTo
- createArrayFrom
- dateTimeToStr
- fillArray
- findItemById
- findItemIndexById
- generateId
- getAllDataTypes
- getDateDataTypes
- getIfDefined
- getStringDataTypes
- indexOfArrayItem
- insertArrayItem
- isIntType
- isNumeric
- isNumericType
- isObject
- isPropSet
- moveArrayItem
- numberToStr
- removeArrayItem
- shiftToFitWindow
- strToDateTime
IsDefinedAndNotNull
Section titled “IsDefinedAndNotNull”▸ IsDefinedAndNotNull(value: any): boolean
Parameters:
Section titled “Parameters:”- value:
any
Returns boolean
areCompatibleDataTypes
Section titled “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:
Section titled “Parameters:”Returns boolean
assign
Section titled “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:
Section titled “Parameters:”- target:
any- the target object - args:
any[] - an array of the source objects
Returns any
assignDeep
Section titled “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,sources: any[]): any
Parameters:
Section titled “Parameters:”- target:
any- the target object - sources:
any[] - an array of the source objects
Returns any
copyArrayTo
Section titled “copyArrayTo”▸ copyArrayTo(collection1: any,collection2: any): void
Parameters:
Section titled “Parameters:”- collection1:
any - collection2:
any
Returns void
createArrayFrom
Section titled “createArrayFrom”▸ createArrayFrom(collection: any): any
Parameters:
Section titled “Parameters:”- collection:
any
Returns any
dateTimeToStr
Section titled “dateTimeToStr”Returns string representation of the date/time value according to the custom format (second parameter) The format is compatible with the one used in .NET: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
▸ dateTimeToStr(date: Date,format: string): string
Parameters:
Section titled “Parameters:”- date:
Date - format:
string-
Returns string
fillArray
Section titled “fillArray”▸ fillArray(arr: Array<T>,value: T,start?: number,end?: number): T[]
Parameters:
Section titled “Parameters:”- arr:
Array<T> - value:
T - start:
number, Default value =0 - end:
number, Optional
Returns T[]
findItemById
Section titled “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:
Section titled “Parameters:”- array:
Array<T> - id:
any-
Returns T
findItemIndexById
Section titled “findItemIndexById”▸ findItemIndexById(array: Array<T>,id: any): number
Parameters:
Section titled “Parameters:”- array:
Array<T> - id:
any
Returns number
generateId
Section titled “generateId”Generates an unique ID
▸ generateId(prefix: string): string
Parameters:
Section titled “Parameters:”- prefix:
string
Returns string
getAllDataTypes
Section titled “getAllDataTypes”▸ getAllDataTypes(): DataType[]
Returns DataType[]
getDateDataTypes
Section titled “getDateDataTypes”▸ getDateDataTypes(): DataType[]
Returns DataType[]
getIfDefined
Section titled “getIfDefined”▸ getIfDefined(value: T,defaultValue: T): T
Parameters:
Section titled “Parameters:”- value:
T - defaultValue:
T
Returns T
getStringDataTypes
Section titled “getStringDataTypes”▸ getStringDataTypes(): DataType[]
Returns DataType[]
indexOfArrayItem
Section titled “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:
Section titled “Parameters:”- arr:
Array<T> - item:
T
Returns number
insertArrayItem
Section titled “insertArrayItem”▸ insertArrayItem(arr: Array<T>,index: number,value: T): void
Parameters:
Section titled “Parameters:”- arr:
Array<T> - index:
number - value:
T
Returns void
isIntType
Section titled “isIntType”Returns true if the DataType value passed in the parameter
represents some numeric type
▸ isIntType(dtype: DataType): boolean
Parameters:
Section titled “Parameters:”- dtype: DataType -
Returns boolean
isNumeric
Section titled “isNumeric”Returns true if the value passed in the parameter is an a numeric value
▸ isNumeric(val: any): boolean
Parameters:
Section titled “Parameters:”- val:
any-
Returns boolean
isNumericType
Section titled “isNumericType”Returns true if the DataType value passed in the parameter
represents some numeric type
▸ isNumericType(dtype: DataType): boolean
Parameters:
Section titled “Parameters:”- dtype: DataType -
Returns boolean
isObject
Section titled “isObject”Returns true if the value passed in the parameter is an object
▸ isObject(val: any): boolean
Parameters:
Section titled “Parameters:”- val:
any-
Returns boolean
isPropSet
Section titled “isPropSet”Returns true if the property with named propName
in the object obj has some value
▸ isPropSet(obj: any,propName: any): any
Parameters:
Section titled “Parameters:”- obj:
any - propName:
any-
Returns any
moveArrayItem
Section titled “moveArrayItem”Moves an item in some array to a new position
▸ moveArrayItem(array: Array<T>,index1: number,index2: number): void
Parameters:
Section titled “Parameters:”- array:
Array<T> - index1:
number - index2:
number-
Returns void
numberToStr
Section titled “numberToStr”Converts a numeric value to the string taking into the account the decimal separator
▸ numberToStr(number: Number,decimalSeparator?: string): string
Parameters:
Section titled “Parameters:”- number:
Number - decimalSeparator:
string, Optional - the symbol that represents decimal separator. If not specified the function gets the one from the current locale settings.
Returns string
removeArrayItem
Section titled “removeArrayItem”Searches for a particular item in the array are removes that item if found.
▸ removeArrayItem(arr: Array<T>,value: T): T
Parameters:
Section titled “Parameters:”- arr:
Array<T> - value:
T-
Returns T
shiftToFitWindow
Section titled “shiftToFitWindow”Calculates the shift on which we need to move our element horizontally to find current window
▸ shiftToFitWindow(absLeft: number,width: number): number
Parameters:
Section titled “Parameters:”- absLeft:
number - width:
number-
Returns number
strToDateTime
Section titled “strToDateTime”▸ strToDateTime(value: string,format: string): Date
Parameters:
Section titled “Parameters:”- value:
string - format:
string
Returns Date