Class: Suit

Suit

Class that implements the Suit's core framework features.

Classes

controller
model
request
view

Methods

staticSuit.assert(p_value, p_default, p_type){Object}

Checks the validity of a value or if it matches the specified type then returns itself or a default value.

Name Type Description
p_value Object

Target

p_default Object

Default value

p_type String nullable

Type of the target to be matched.

Returns:
Type Description
Object
  • If 'target' is null or not of 'type' (when used) returns the 'default' value.
Example

var s = null;
Suit.assert(s,"default"); //returns 'default'
s = "ok";
Suit.assert(s,"default"); //returns 'ok'
Suit.assert(s,"default","Number"); //returns 'default'
Suit.assert(s,"default","String"); //returns 'ok'

staticSuit.isNullOrEmpty(p_string){Boolean}

Checks if a given string is either null or empty.

Name Type Description
p_string String

String value.

Returns:
Type Description
Boolean
  • Flag indicating if the string is null or empty.
Example

var s = "";
Suit.isNullOrEmpty(s); //returns true
s = null;
Suit.isNullOrEmpty(s); //returns true
s = "ok";
Suit.isNullOrEmpty(s); //returns false

comments powered by Disqus