Plato on Github
Report Home
ampersand/template/shared/client/models/person.js
Maintainability
92.47
Lines of code
40
Difficulty
10.64
Estimated Errors
0.28
Function weight
By Complexity
By SLOC
var AmpersandModel = require('ampersand-model'); module.exports = AmpersandModel.extend({ props: { id: 'any', firstName: ['string', true, ''], lastName: ['string', true, ''], coolnessFactor: ['number', true, 5] }, session: { selected: ['boolean', true, false] }, derived: { fullName: { deps: ['firstName', 'lastName'], fn: function () { return this.firstName + ' ' + this.lastName; } }, avatar: { deps: ['firstName', 'lastName'], fn: function () { return 'http://robohash.org/' + encodeURIComponent(this.fullName) + '?size=80x80'; } }, editUrl: { deps: ['id'], fn: function () { return '/person/' + this.id + '/edit'; } }, viewUrl: { deps: ['id'], fn: function () { return '/person/' + this.id; } } } });