-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·35 lines (33 loc) · 869 Bytes
/
index.js
File metadata and controls
executable file
·35 lines (33 loc) · 869 Bytes
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
const format = require("./lib/format");
const defaultConfig = require("./config");
const buzzphrase = {
// deprecated
buzz: function (iterations) {
console.log(buzzphrase.getPhrase(iterations));
},
// newer, official API
get: function (config) {
const conf = Object.assign({}, defaultConfig, config);
let formatString = conf.format;
if (conf.iterations > 1) {
for (var i = 1; i < conf.iterations; i++) {
formatString += "{c} " + conf.format;
}
}
return format(formatString);
},
getImperative: function (iterations) {
return buzzphrase.get({
format: "{i} {v} {a} {N}",
});
},
getPhrase: function (iterations) {
return buzzphrase.get({
iterations: iterations || 1,
});
},
log: function (config) {
console.log(buzzphrase.get(config));
},
};
module.exports = buzzphrase;