Skip to content

Instantly share code, notes, and snippets.

@heymichaelp
Created March 25, 2014 21:00
Show Gist options
  • Select an option

  • Save heymichaelp/9771209 to your computer and use it in GitHub Desktop.

Select an option

Save heymichaelp/9771209 to your computer and use it in GitHub Desktop.
var moment = require('moment');
var Review = function( review ) {
this.review = review;
}
Review.prototype.authorFullName = function() {
return [ this.review.author.firstName, this.review.author.firstName ].join(' ');
}
Review.prototype.asteriskRating = function() {
return '*****'.substr( 0, this.review.rating );
}
Review.prototype.ratedOn = function() {
return moment( this.review.ratedOn ).format('L');
}
module.exports = Review;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment