(.js)
laraImport("lara.Check");
(.lara)
import lara.Check;
Check
Utility methods to check preconditions.
arrayContains(array, element, message, source)
Checks if the array contains the element. Throws an expression if it doens't.
The test is equivalent to array.indexOf(element) != -1.
diff(original, revised)
instance(value, type, source, userTypeName)
isArray(variable, source)
isBoolean(variable, source)
isDefined(value, varName, source)
isJoinPoint($jp, [type = undefined], [isOptional = false])
Checks if the given value is a join point. If a type is given, checks if the join point is an instance of the given type. Otherwise, throws an exception.
isNumber(variable, source)
isRegex(variable, source)
isString(variable, source)
isTrue(booleanExpr, message, source)
Throws an exception if the given expression evaluates to false.
isUndefined(value)
strings(currentString, expectedString)
Checks if two strings are identical, not considering empty spaces. Throws and exception if strings do not match.
type(value, type, source)