# Ensure.js

Summary

Ensure.js |
Functions |
ensureTrue | Checks if given argument is the boolean value “true”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFalse | Checks if given argument is the boolean value “false”., throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureExists | Checks if given argument exists (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureString | Checks if given argument is string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNumber | Checks if given argument is number, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureNotEmptyString | Checks if given argument is a non-empty string, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureObject | Checks if given argument is an object (not null, not undefined), throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureArray | Checks if given argument is an array, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureFunction | Checks if given argument is a function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureInstanceOf | Checks if given value is an instance of the given function, throws {Legato.Lang.IllegalArgumentException} otherwise.
ensureImplements | Checks 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

value | value 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

value | value 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

value | value to check.
message | {String} exception message (optional).

### ensureString

> ensureString : function( | value,
> | message | )

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

#### Parameters

value | value to check.
message | {String} exception message (optional).

### ensureNumber

> ensureNumber : function( | value,
> | message | )

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

#### Parameters

value | value 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

value | value 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

value | value 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

value | value 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

value | value 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

value | value 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

value | value 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.