bwc
This commit is contained in:
parent
04fb7ba032
commit
320de62f13
348 changed files with 7745 additions and 30874 deletions
41
src/js/models/profile.js
Normal file
41
src/js/models/profile.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Profile
|
||||
*
|
||||
* credential: array of OBJECTS
|
||||
*/
|
||||
function Profile() {
|
||||
this.version = '1.0.0';
|
||||
};
|
||||
|
||||
Profile.create = function(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
var x = new Profile();
|
||||
x.createdOn = Date.now();
|
||||
x.credentials = opts.credentials;
|
||||
return x;
|
||||
};
|
||||
|
||||
|
||||
Profile.fromObj = function(obj) {
|
||||
var x = new Profile();
|
||||
x.createdOn = obj.createdOn;
|
||||
x.credentials = obj.credentials;
|
||||
if (x.credentials[0] && typeof x.credentials[0] != 'object')
|
||||
throw ("credentials should be an object");
|
||||
return x;
|
||||
};
|
||||
|
||||
|
||||
Profile.fromString = function(str) {
|
||||
return Profile.fromObj(JSON.parse(str));
|
||||
};
|
||||
|
||||
Profile.prototype.toObj = function() {
|
||||
console.log('[profile.js.37:this:]',this); //TODO
|
||||
return JSON.stringify(this);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue