get
Get a value or all values from a DefineMap.
map.get()
Returns a plain JavaScript object that contains the properties and values of the map instance. Any property values
that also have a get
method will have their get
method called and the resulting value will be used as
the property value. This can be used to recursively convert a map instance to an object of other plain
JavaScript objects. Cycles are supported and only create one object.
.get()
can still return other non plain JS objects like Date.
Use serialize when a form proper for JSON.stringify
is needed.
var map = new DefineMap({foo: new DefineMap({bar: "zed"})});
map.get() //-> {foo: {bar: "zed"}};
Returns
{Object}
:
A plain JavaScript Object
that contains all the properties and values of the map instance.
map.get(propName)
Get a single property on a DefineMap instance.
.get(propName)
only should be used when reading properties that might not have been defined yet, but
will be later via set.
var map = new DefineMap();
map.get("name") //-> undefined;
Parameters
- propName
{String}
:The property name of a property that may not have been defined yet.
Returns
{*}
:
The value of that property.