InternalFunctionUtils class
Utility functions only used internal
Properties
Millisecond |
Constant to convert between ticks and ms. |
Unix |
Constant for converting unix timestamp to ticks. |
Methods
access |
Lookup a string or number index of an Object. |
access |
Lookup a property in Map or Object. |
common |
Common Stringify an object. |
convert |
Convert an object into array. If the instance is array, return itself. If the instance is object, return {key, value} pair list. Else return undefined. |
foreach(Expression, Memory |
Evaluator for foreach and select functions. |
get |
TextDecoder helper function. |
get |
TextEncoder helper function. |
is |
Test result to see if True in logical comparison functions. |
lambda |
Lambda evaluator. |
parse |
Wrap string or undefined into string. Default to empty string. |
parse |
Parse timex funcition. |
parse |
Parse string into URL object. |
sort |
Sort helper function. |
ticks(string) | Convert a string input to ticks number. |
time |
Transform C# period and unit into js period and unit. |
Validate |
Validator for foreach, select, and where functions. |
verify |
Verify a timestamp string is valid ISO timestamp format. |
verify |
Verify a timestamp string is valid timestamp format. |
wrap |
Get the value of a path from a memory. |
Property Details
MillisecondToTickConstant
Constant to convert between ticks and ms.
static MillisecondToTickConstant: BigInteger = bigInt('10000')
Property Value
BigInteger
UnixMilliSecondToTicksConstant
Constant for converting unix timestamp to ticks.
static UnixMilliSecondToTicksConstant: BigInteger = bigInt('621355968000000000')
Property Value
BigInteger
Method Details
accessIndex(any, number)
Lookup a string or number index of an Object.
static function accessIndex(instance: any, index: number): ValueWithError
Parameters
- instance
-
any
Instance with property.
- index
-
number
Property to lookup.
Returns
Value and error information if any.
accessProperty(any, string)
Lookup a property in Map or Object.
static function accessProperty(instance: any, property: string): ValueWithError
Parameters
- instance
-
any
Instance with property.
- property
-
string
Property to lookup.
Returns
Value and error information if any.
commonStringify(unknown)
Common Stringify an object.
static function commonStringify(input: unknown): string
Parameters
- input
-
unknown
input object.
Returns
string
the stringified object.
convertToList(unknown)
Convert an object into array. If the instance is array, return itself. If the instance is object, return {key, value} pair list. Else return undefined.
static function convertToList(instance: unknown): unknown[] | undefined
Parameters
- instance
-
unknown
input instance.
Returns
unknown[] | undefined
The generated list.
foreach(Expression, MemoryInterface, Options)
Evaluator for foreach and select functions.
static function foreach(expression: Expression, state: MemoryInterface, options: Options): ValueWithError
Parameters
- expression
- Expression
Expression.
- state
- MemoryInterface
Memory scope.
- options
- Options
Options.
Returns
The evaluated list.
getTextDecoder(string)
TextDecoder helper function.
static function getTextDecoder(code: string): TextDecoder
Parameters
- code
-
string
The encoding format.
Returns
TextDecoder
The text decoder.
getTextEncoder()
TextEncoder helper function.
static function getTextEncoder(): TextEncoder
Returns
TextEncoder
The text encoder.
isLogicTrue(any)
Test result to see if True in logical comparison functions.
static function isLogicTrue(instance: any): boolean
Parameters
- instance
-
any
Computed value.
Returns
boolean
True if boolean true or non-null.
lambdaEvaluator<T, U>(Expression, MemoryInterface, Options, T[], (currentItem: T, result: U, error: string) => boolean)
Lambda evaluator.
static function lambdaEvaluator<T, U>(expression: Expression, state: MemoryInterface, options: Options, list: T[], callback: (currentItem: T, result: U, error: string) => boolean)
Parameters
- expression
- Expression
expression.
- state
- MemoryInterface
memory state.
- options
- Options
options.
- list
-
T[]
item list.
- callback
-
(currentItem: T, result: U, error: string) => boolean
call back. return the should break flag.
parseStringOrUndefined(string | undefined)
Wrap string or undefined into string. Default to empty string.
static function parseStringOrUndefined(input: string | undefined): string
Parameters
- input
-
string | undefined
Input string
Returns
string
The wrapped string.
parseTimexProperty(any)
Parse timex funcition.
static function parseTimexProperty(timexExpr: any): { error: string, timexProperty: TimexProperty }
Parameters
- timexExpr
-
any
String or TimexProperty input.
Returns
{ error: string, timexProperty: TimexProperty }
TimexProperty and error.
parseUri(string)
Parse string into URL object.
static function parseUri(uri: string): ValueWithError
Parameters
- uri
-
string
Input string uri.
Returns
The parsed URL object.
sortBy(boolean)
Sort helper function.
static function sortBy(isDescending: boolean): EvaluateExpressionDelegate
Parameters
- isDescending
-
boolean
Descending flag.
Returns
The sorted array.
ticks(string)
Convert a string input to ticks number.
static function ticks(timeStamp: string): ValueWithError
Parameters
- timeStamp
-
string
String timestamp input.
Returns
The string converted in ticks.
timeUnitTransformer(number, string)
Transform C# period and unit into js period and unit.
static function timeUnitTransformer(duration: number, cSharpStr: string): { duration: number, tsStr: OpUnitType }
Parameters
- duration
-
number
C# duration.
- cSharpStr
-
string
C# unit.
Returns
{ duration: number, tsStr: OpUnitType }
The transformed timeUnit.
ValidateLambdaExpression(Expression)
Validator for foreach, select, and where functions.
static function ValidateLambdaExpression(expression: Expression)
Parameters
- expression
- Expression
The expression to validate.
verifyISOTimestamp(any)
Verify a timestamp string is valid ISO timestamp format.
static function verifyISOTimestamp(value: any): string | undefined
Parameters
- value
-
any
Timestamp string to check.
Returns
string | undefined
Error or undefined if invalid.
verifyTimestamp(any)
Verify a timestamp string is valid timestamp format.
static function verifyTimestamp(value: any): string | undefined
Parameters
- value
-
any
Timestamp string to check.
Returns
string | undefined
Error or undefined if invalid.
wrapGetValue(MemoryInterface, string, Options)
Get the value of a path from a memory.
static function wrapGetValue(state: MemoryInterface, path: string, options: Options): any
Parameters
- state
- MemoryInterface
Memory.
- path
-
string
Path string.
- options
- Options
Options.
Returns
any
The value of a path from a memory.