Ensure.js

Summary
Ensure.js
Functions
ensureTrueChecks if given argument is the boolean value “true”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFalseChecks if given argument is the boolean value “false”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureExistsChecks if given argument exists (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureStringChecks if given argument is string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNumberChecks if given argument is number, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNotEmptyStringChecks if given argument is a non-empty string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureObjectChecks if given argument is an object (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureArrayChecks if given argument is an array, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFunctionChecks if given argument is a function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureInstanceOfChecks if given value is an instance of the given function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureImplementsChecks if given value implements a function with the given name, throws {Legato.Lang.IllegalArgumentException} otherwise.

Functions

ensureTrue

ensureTrue : function(value,
message)

Checks if given argument is the boolean value “true”., throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureFalse

ensureFalse : function(value,
message)

Checks if given argument is the boolean value “false”., throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureExists

ensureExists : function(value,
message)

Checks if given argument exists (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureString

ensureString : function(value,
message)

Checks if given argument is string, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureNumber

ensureNumber : function(value,
message)

Checks if given argument is number, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureNotEmptyString

ensureNotEmptyString : function(value,
message)

Checks if given argument is a non-empty string, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureObject

ensureObject : function(value,
message)

Checks if given argument is an object (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureArray

ensureArray : function(value,
message)

Checks if given argument is an array, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureFunction

ensureFunction : function(value,
message)

Checks if given argument is a function, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
message{String} exception message (optional).

ensureInstanceOf

ensureInstanceOf : function(value,
f,
message)

Checks if given value is an instance of the given function, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
f{Function} potential constructor function.
message{String} exception message (optional).

ensureImplements

ensureImplements : function(value,
functionName,
message)

Checks if given value implements a function with the given name, throws {Legato.Lang.IllegalArgumentException} otherwise.

Parameters

valuevalue to check.
functionName{String} name of the function.
message{String} exception message (optional).
ensureTrue : function(value,
message)
Checks if given argument is the boolean value “true”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFalse : function(value,
message)
Checks if given argument is the boolean value “false”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureExists : function(value,
message)
Checks if given argument exists (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureString : function(value,
message)
Checks if given argument is string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNumber : function(value,
message)
Checks if given argument is number, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNotEmptyString : function(value,
message)
Checks if given argument is a non-empty string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureObject : function(value,
message)
Checks if given argument is an object (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureArray : function(value,
message)
Checks if given argument is an array, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFunction : function(value,
message)
Checks if given argument is a function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureInstanceOf : function(value,
f,
message)
Checks if given value is an instance of the given function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureImplements : function(value,
functionName,
message)
Checks if given value implements a function with the given name, throws {Legato.Lang.IllegalArgumentException} otherwise.