Model
DESCRIPTION
General
Installation
npm install eden-model
Usage
var model = require('eden-model');
Methods
set
object set({ name: 'chris', age: 32 });
Set the raw data hash
Parameters
- chris - object (string | character | integer | date) to be set
Returns
object
Example
Code
model({ name: 'chris', age: 32 }).setAge(45).getAge();
Outputs
45
get
object get('john');
Return a copy of the raw data hash
Parameters
- 'john' - object (string | character | integer | date) to get
Returns
object
Example
Code
var user = model({ name: 'chris', age: 32 });
user.name = 'john';
user.getName();
Outputs
'john'
copy
Eden_Model copy(name, nickname);
Copies a value of source key to destination key.
Parameters
-
name - string (to copy)
-
nickname - string (copy value from name)
Returns
Eden_Model
Example
Code
var user = model({ name : 'chris', age : 32 }).copy('name', 'nickname');
user.nickname;
Outputs
'chris'