-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (35 loc) · 1.07 KB
/
index.js
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
let exp = require('./index.json'), c = require('chalk'), ls = require('log-symbols'), pathed = require('object-path')(exp);
/**
* @description Get a element from an object given the path.
* @param {string} p The path.
* @param {object} o The object to search in.
*/
exports.succeed = (what) => {
let chalkF = pathed.get(what + '.succeed.color') || 'green';
chalkF = c[chalkF];
let r = pathed.get(what + '.succeed.text') || ls.success;
r = chalkF(r);
return r;
}
exports.fail = (what) => {
let chalkF = pathed.get(what + '.fail.color') || 'red';
chalkF = c[chalkF];
let r = pathed.get(what + '.fail.text') || ls.error;
r = chalkF(r);
return r;
}
exports.warn = (what) => {
let chalkF = pathed.get(what + '.warn.color') || 'yellow';
chalkF = c[chalkF];
let r = pathed.get(what + '.warn.text') || ls.warning;
r = chalkF(r);
return r;
}
exports.info = (what) => {
let chalkF = pathed.get(what + '.info.color') || 'blue';
chalkF = c[chalkF];
let r = pathed.get(what + '.info.text') || ls.info;
r = chalkF(r);
return r;
}
module.exports = Object.assign({}, exports, exp);