Copyright 2015 Randal L Kamradt Sr.
Meta-data property definition.
- Source:
(require("meta-data/meta-property"))(json) → {Object}
factory for creating a model definition from json. pre-calculates
the map of properties and the key property
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | the parsed json that defines the model |
- Source:
Returns:
An API Object
- Type
- Object
- Source:
(require("meta-data/meta-property"))(json) → {Object}
factory for creating a property defintion object from json
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | The parsed JSON from the data definition file |
- Source:
Returns:
An API Object
- Type
- Object
Methods
(inner) apply(obj, data)
Apply data values to an object
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | The Object to update |
data |
Object | The data to apply |
- Source:
(inner) create(data) → {Object}
Create a new data object that conforms to the data defintion
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data to optionally apply |
- Source:
Returns:
The new object
- Type
- Object
(inner) getKey() → {Object}
returns the key property
- Source:
Returns:
the key property
- Type
- Object
(inner) getName() → {string}
return the name of this model
- Source:
Returns:
the name of this model
- Type
- string
(inner) getProperties() → {Object}
returns the property map
- Source:
Returns:
the property map
- Type
- Object
(inner) getProperty(name) → {Object}
returns a named property
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the name of the property |
- Source:
Returns:
the named property
- Type
- Object
(inner) isValid(data) → {boolean}
determines if an object complies with all the rules for
this model.
TODO think about how this returns information about how
an object is invalid and all the possible reasons an
object might be invalid
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The object in question |
- Source:
Returns:
True if the object is valid
- Type
- boolean