jsbeans

jsbeans  1.0.0

jsbeans > jsbeans > jsbeans.mvc.model
Search:
 
Filters

static Class jsbeans.mvc.model

Simple small collection of utility methods to manage Object.

Methods

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>. null otherwise

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 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 when first is of type Array
Returns: JSON
merged object. An empty JSON if first is null or undefined

populate

static void populate ( json , object )
Cicles through {@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


Copyright © 2016 Francesco Mele. All rights reserved.