Created
February 14, 2014 16:28
-
-
Save dillonforrest/9004208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////// | |
// data generation | |
////////////////////////////////////////////////// | |
var _ = require('underscore'); | |
function genStaticData() { | |
var alphabet = 'abcdefghijklmnopqrstuvqxyz'; | |
return _.range(69).map(function makePublisher() { | |
return { | |
site: genWord() + '.com', | |
status: genStatus(), | |
size: genSize(), | |
owner: genWord(), | |
guid: _.uniqueId(), | |
}; | |
}); | |
// utility fns | |
function genWord() { | |
return _.range( _.random(6) + 5 ).map(function randLetter() { | |
return randomNth(alphabet); | |
}).join(''); | |
} | |
function genStatus() { | |
var statuses = ['inactive', 'live', 'none', 'prospecting']; | |
return randomNth(statuses); | |
} | |
function genSize() { | |
var sizes = ['small', 'medium', 'large']; | |
return randomNth(sizes); | |
} | |
function randomNth(array) { | |
return array[ _.random(array.length - 1) ]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment