create
static
Object
create
(
model
)
Tries to create a new instance of {@param}
model evaluating new <model>()
- Parameters:
-
model <String>a name of a class
- Returns:
Object - a new instance of
<model>.nullotherwise
merge
static
JSON
merge
(
first
,
[object]
)
Merges objects passed as arguments. In other words the returning object will be a JSON resulting as union of all objects passed, with no duplicates.
If first argument is an
Any subsequent key will override previously key/value pair.
If first argument is an
Array no other argument is taken into account and the merge process will cycle through that Array.Any subsequent key will override previously key/value pair.
- Parameters:
-
first <JSON | Object | Array>first (and unique in case of type Array) object to cycle through -
[object] <arguments[1..n]>optional arguments of objects to merge. Ignored whenfirstis of typeArray
- Returns:
JSON - merged object. An empty JSON if
firstisnullorundefined
populate
static
void
populate
(
json
,
object
)
Cicles through {@param}
Note that {@param}
json keys and stores corresponding values into {@param} object.Note that {@param}
object will have new values only if it already has same properties, or a superset, of {@param} json. It does not add new property on {@param} object.
- Parameters:
-
json <JSON>a set of key/value pairs in JSON format -
object <Object>an instance of an Object.
- Returns:
void