Browse Source

linted

master
Julio Biason 11 years ago
parent
commit
c520940283
  1. 16
      lyricsnode/routes/round.js

16
lyricsnode/routes/round.js

@ -9,20 +9,18 @@ var db; // make it global
/** /**
* db name * db name
*/ */
function dbName() function dbName() {
{
return path.join(__dirname, '../../db/lyrics.sq3'); return path.join(__dirname, '../../db/lyrics.sq3');
} }
/** /**
* turn a phrase into a list of acronyms * turn a phrase into a list of acronyms
*/ */
function acronymize(phrase) function acronymize(phrase) {
{
var letters = []; var letters = [];
phrase.split(' ').forEach(function (elem, idx, array) { phrase.split(' ').forEach(function (elem, idx, array) {
letters.push(elem[0].toUpperCase()); letters.push(elem[0].toUpperCase());
}) });
return letters.join(''); return letters.join('');
} }
@ -54,12 +52,13 @@ function getSong(res) {
throw err; throw err;
} }
params = {title: 'Round', var params = {title: 'Round',
lyrics: lyrics.lyrics, lyrics: lyrics.lyrics,
song_title: song.title, song_title: song.title,
song_artist: artist.name, song_artist: artist.name,
acronym_title: acronymize(song.title), acronym_title: acronymize(song.title),
acronym_artist: acronymize(artist.name) acronym_artist: acronymize(artist.name),
id: song.id
}; };
res.render('index', params); res.render('index', params);
}); });
@ -69,6 +68,5 @@ function getSong(res) {
} }
exports.index = function (req, res) { exports.index = function (req, res) {
// res.render('index', { title: 'Round'} );
getSong(res); getSong(res);
} };
Loading…
Cancel
Save