-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (34 loc) · 1.13 KB
/
Copy pathindex.js
File metadata and controls
46 lines (34 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var colors = require('colors'),
allColors = Object.keys(colors.styles),
log = console.log;
let color = 'white'; // default
/**
* Random number seed (uses random.js)
* @param {Number} lower
* @param {Number} upper
* @return {Number}
*/
var randomNumber = function(lower, upper) {
lower = lower || 0;
upper = upper || 0;
const Random = require('random-js');
let random = new Random(Random.engines.mt19937().autoSeed());
return random.integer(lower, upper);
};
/**
* "Extends" console.log adding in a pointless ascii drawing of a dog
*/
console.dog = function() {
if (arguments && arguments[0] === 'color'){
color = arguments[1] && allColors.map(color => { return color === arguments[1]; }).indexOf(true) > -1 ? arguments[1] : allColors[randomNumber(1, allColors.length) - 1];
return;
}
let animals = [
" __\n(\\,--------'()'--o\n (_ ___ /~\"\n (_)_) (_)_)",
" _.-.\n '( ^{_} (\n `~\\`-----'\\\n )_)---)_) ",
" __\n(___()'`;\n/, /`\n\\\\\"--\\\\"
];
let animal = animals[randomNumber(1, animals.length) - 1];
log(animal[color] + '\n\n');
log.apply(console, arguments);
};