var Serializer = require('dataserializer');
var model = {
username: 'kulakowka',
firstname: 'Anton',
lastname: 'Kulakov',
password: 'qwerty'
}
var collection = [model, model];
var rules = {
'username': true,
'fullname': function() {
return this.firstname + ' ' + this.lastname;
}
}
var model = Serializer(rules, model);
console.log('Serialized model', model);
var collection = Serializer(rules, collection);
console.log('Serialized collection', collection);
/*
Serialized model
{
username: 'kulakowka',
fullname: 'Anton Kulakov'
}
Serialized collection
[
{
username: 'kulakowka',
fullname: 'Anton Kulakov'
},
{
username: 'kulakowka',
fullname: 'Anton Kulakov'
}
]
*/
-
Notifications
You must be signed in to change notification settings - Fork 0
Simple data serializer for node.js
gitter-badger/DataSerializer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple data serializer for node.js
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published