rooibos/common

rooibos/common

Methods

(static) arrayContains(array, value, compareAttributeopt) → {boolean}

check if array contains specified value

Source:
Parameters:
Name Type Attributes Default Description
array Dynamic

array to search in

value Dynamic

value to check

compareAttribute Dynamic <optional>
invalid

attribute to compare on

Returns:
Type:
boolean

true if array contains a value, else return false

(static) asArray(value) → {object}

if type of value equals array return value, else return array with one element [value]

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
object

converted array

(static) asBoolean(value) → {boolean}

convert value to Boolean if this possible, else return False

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

converted boolean

(static) asDouble(value) → {double}

convert value to Double if this possible, else return 0.0

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
double

converted Double

(static) asFloat(value) → {float}

convert value to Float if this possible, else return 0.0

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
float

converted Float

(static) asInteger(value) → {integer}

convert value to Integer if this possible, else return 0

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
integer

converted Integer

(static) asLongInteger(value) → {longinteger}

convert value to LongInteger if this possible, else return 0

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
longinteger

converted LongInteger

(static) asMultilineString(value, includeTypeopt, indentionopt) → {string}

convert value to multiline String if this possible, else return empty string

Source:
Parameters:
Name Type Attributes Default Description
value Dynamic

value to check

includeType boolean <optional>
false
indention integer <optional>
0
Returns:
Type:
string

converted string

(static) asString(value, includeTypeopt) → {string}

convert value to String if this possible, else return empty string

Source:
Parameters:
Name Type Attributes Default Description
value Dynamic

value to check

includeType boolean <optional>
false
Returns:
Type:
string

converted string

(static) canSafelyIterateAAKey(aa, key) → {boolean}

Source:
Parameters:
Name Type Description
aa roAssociativeArray
key string
Returns:
Type:
boolean

(static) eqArray(Value1, Value2, fuzzyopt, callCountopt) → {dynamic}

Compare to roArray objects for equality.

Source:
Parameters:
Name Type Attributes Default Description
Value1 Dynamic

first array

Value2 Dynamic

second array

fuzzy boolean <optional>
false
callCount integer <optional>
0
Returns:
Type:
dynamic

True if arrays are equal or False in other case.

(static) eqAssocArray(Value1, Value2, fuzzyopt, callCountopt) → {dynamic}

Compare to roAssociativeArray objects for equality.

Source:
Parameters:
Name Type Attributes Default Description
Value1 Dynamic

first associative array

Value2 Dynamic

second associative array

fuzzy boolean <optional>
false
callCount integer <optional>
0
Returns:
Type:
dynamic

True if arrays are equal or False in other case.

(static) eqTypes(Value1, Value2) → {dynamic}

Source:
Parameters:
Name Type Description
Value1 dynamic
Value2 dynamic
Returns:
Type:
dynamic

(static) eqValues(Value1, Value2, fuzzyopt, callCountopt) → {dynamic}

Compare two arbitrary values to each-other.

Source:
Parameters:
Name Type Attributes Default Description
Value1 Dynamic

first item to compare

Value2 Dynamic

second item to compare

fuzzy boolean <optional>
false
callCount integer <optional>
0
Returns:
Type:
dynamic

True if values are equal or False in other case.

(static) fillText(text, fillCharopt, numCharsopt) → {string}

Fills text with count of fillChars

Source:
Parameters:
Name Type Attributes Default Description
text String

text to fill

fillChar String <optional>
" "

char to fill with

numChars Integer <optional>
40

target length

Returns:
Type:
string

filled string

(static) findElementIndexInArray(array, value, compareAttributeopt, caseSensitiveopt, callCountopt) → {integer}

find an element index in array

Source:
Parameters:
Name Type Attributes Default Description
array Dynamic

array to search

value Dynamic

value to check

compareAttribute Dynamic <optional>
invalid

attribute to use for comparisons

caseSensitive Boolean <optional>
false

indicates if comparisons are case sensitive

callCount integer <optional>
0
Returns:
Type:
integer

element index if array contains a value, else return -1

(static) findElementIndexInNode(node, value) → {integer}

find an element index in node

Source:
Parameters:
Name Type Description
node Dynamic

node to search in

value Dynamic

child to search for

Returns:
Type:
integer

element index if node contains a value, else return -1

(static) getFunction(filename, functionName) → {object}

looks up the function by name, for the function map

Source:
Parameters:
Name Type Description
filename String

name of the file where the function was found

functionName String

name of the function to locate

Returns:
Type:
object

function pointer or invalid

(static) getFunctionBruteForce(functionName) → {object}

looks up the function by name, from any function map in future

Source:
Parameters:
Name Type Description
functionName String

name of the function to locate

Returns:
Type:
object

function pointer or invalid

(static) getSafeType(v) → {dynamic}

Source:
Parameters:
Name Type Description
v dynamic
Returns:
Type:
dynamic

(static) getTypeWithComponentWrapper(value, includeSubtypeopt) → {string}

Takes a value and if the value is not a primitive it will wrap the type in a Component: tag like the debugger does

Source:
Parameters:
Name Type Attributes Default Description
value Dynamic

value to check the type of

includeSubtype Boolean <optional>
false

If true and the value is a node the result will include the node subtype

Returns:
Type:
string

Formatted result. Examples: 'String', 'Integer', '<Component: roDateTime>', '<Component: roSGNode:Node>'

(static) isArray(value) → {boolean}

check if value contains Array interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains Array interface, else return false

(static) isAssociativeArray(value) → {boolean}

check if value contains AssociativeArray interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains AssociativeArray interface, else return false

(static) isBoolean(value) → {boolean}

check if value contains Boolean interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains Boolean interface, else return false

(static) isDateTime(value) → {boolean}

check if value contains DateTime interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains DateTime interface, else return false

(static) isDouble(value) → {boolean}

check if value contains Double interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains Double interface, else return false

(static) isFloat(value) → {boolean}

check if value contains Float interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains Float interface, else return false

(static) isFunction(value) → {boolean}

check if value contains Function interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains Function interface, else return false

(static) isInteger(value) → {boolean}

check if value type equals Integer

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value type equals Integer, else return false

(static) isList(value) → {boolean}

check if value contains List interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains List interface, else return false

(static) isLongInteger(value) → {boolean}

check if value contains LongInteger interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains LongInteger interface, else return false

(static) isNotEmptyString(value) → {boolean}

check if value contains String interface and length more 0

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains String interface and length more 0, else return false

(static) isNullOrEmpty(value) → {boolean}

check if value is invalid or empty

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value is null or empty string, else return false

(static) isNumber(value) → {boolean}

check if value contains LongInteger or Integer or Double or Float interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value is number, else return false

(static) isSGNode(value) → {boolean}

check if value contains SGNodeChildren interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains SGNodeChildren interface, else return false

(static) isString(value) → {boolean}

check if value contains String interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains String interface, else return false

(static) isUndefined(value) → {boolean}

check if value uninitialized or empty string

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value is uninitialized or "", else return false

(static) isValid(value) → {boolean}

check if value initialized and not equal invalid

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value initialized and not equal invalid, else return false

(static) isXmlElement(value) → {boolean}

check if value contains XMLElement interface

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
boolean

true if value contains XMLElement interface, else return false

(static) makePathStubbable(content, path) → {dynamic}

Source:
Parameters:
Name Type Description
content dynamic
path string
Returns:
Type:
dynamic

(static) nodeContains(node, value) → {boolean}

check if node contains specified child

Source:
Parameters:
Name Type Description
node Dynamic

the node to check on

value Dynamic

child to look for

Returns:
Type:
boolean

true if node contains a value, else return false

(static) truncateString(maxLength, value, lengthopt, collapseNewlinesopt) → {string}

Takes a string and formats and truncates a string for more compact printing.

Source:
Parameters:
Name Type Attributes Default Description
maxLength Integer

the max length of the resulting string

value Dynamic

string to format

length integer <optional>
38
collapseNewlines Boolean <optional>
true

Will convert newlines and spaces into a single space

Returns:
Type:
string

Formatted result

(static) validStr(value) → {string}

return value if his contains String interface else return empty string

Source:
Parameters:
Name Type Description
value Dynamic

value to check

Returns:
Type:
string

value if his contains String interface else return empty string