Member: restUtil

Utility object containing logic that is completely orthogonal from REST


restUtil Methods

(static) -> isEmpty(obj)

Returns true if an object is empty

Parameters:
Name Required Type Default Value Description
obj Y Object   object to check

Returns:
Type Description
boolean true if the object is null or empty

(static) -> isValidTextInput()


(static) -> getNowMicrosUtc()

Returns number of microseconds since epoch.


(static) -> extend(target, base)

extend base object properties onto the target object. if both define the same property, then target’s property wins. Supports aspected programming.

Parameters:
Name Required Type Default Value Description
target Y      
base Y      

Examples:

base.start$before ()-> say '1'
base.start$after ()-> say '3'
target.start ()-> say '2'

before:
target.start() : say '2'

after:
restUtil.extend(target, base);
target.start() :
             say '1'
             say '2'
             say '3'

(static) -> contains(arry, func)

check if an elem is contains in array

Parameters:
Name Required Type Default Value Description
arry Y      
func Y      

Returns:
Type Description
boolean  

(static) -> deepCopy(obj)

Does a deep copy via serialization to deep copy and object

Parameters:
Name Required Type Default Value Description
obj Y     instance object to clone

Returns:
Type Description
  deep copy of object

(static) -> arrayToHashtable(arry, [keyProperty])

convert an array to hashtable: [“a”, “b”] => {“a”:”a”, “b”:”b”}

Parameters:
Name Required Type Default Value Description
arry Y      
keyProperty N     the key to use for the hashtable in case of array

Returns:
Type Description
Object