Skip to content

Instantly share code, notes, and snippets.

@whalesalad
Created May 28, 2012 19:11
Show Gist options
  • Select an option

  • Save whalesalad/2820753 to your computer and use it in GitHub Desktop.

Select an option

Save whalesalad/2820753 to your computer and use it in GitHub Desktop.
(function() {
var User;
User = (function() {
function User(user_data) {
this.name = user_data.your_name;
this.email = user_data.your_email;
this.has_facebook = user_data.has_facebook;
this.age = user_data.your_age;
this.ratings = {};
console.log("<New User: " + this.name + ", " + this.email + ">");
}
User.prototype.get_first_name = function() {
return this.name.split(' ')[0];
};
User.prototype.get_serialized = function() {
return {
name: this.name,
email: this.email,
facebook: this.has_facebook,
age: this.age,
ratings: this.ratings
};
};
return User;
})();
window.User = User;
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment