@stonyx/logs 1.0.1-beta.12 → 1.0.1-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/color.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/color.js
CHANGED
|
@@ -13,7 +13,7 @@ export default class Color {
|
|
|
13
13
|
}
|
|
14
14
|
// retrieves chalk color function, and fully validates output
|
|
15
15
|
settingToChalkColorFunction(setting) {
|
|
16
|
-
const errorMessage = 'Invalid chalk color function.'
|
|
16
|
+
const errorMessage = 'Invalid chalk color function. '
|
|
17
17
|
+ 'For help with color settings, see https://github.com/abofs/stonyx-logs#defining-logs--colors';
|
|
18
18
|
switch (typeof setting) {
|
|
19
19
|
case 'string':
|
|
@@ -23,17 +23,17 @@ export default class Color {
|
|
|
23
23
|
if (!chalkColorFunction
|
|
24
24
|
|| typeof chalkColorFunction !== 'function'
|
|
25
25
|
|| typeof chalkColorFunction('') !== 'string') {
|
|
26
|
-
throw errorMessage;
|
|
26
|
+
throw new Error(errorMessage);
|
|
27
27
|
}
|
|
28
28
|
return chalkColorFunction;
|
|
29
29
|
case 'function':
|
|
30
30
|
// validate that given function returns a string
|
|
31
31
|
if (typeof setting('') !== 'string') {
|
|
32
|
-
throw errorMessage;
|
|
32
|
+
throw new Error(errorMessage);
|
|
33
33
|
}
|
|
34
34
|
return setting;
|
|
35
35
|
default:
|
|
36
|
-
throw errorMessage;
|
|
36
|
+
throw new Error(errorMessage);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
package/dist/index.js
CHANGED
|
@@ -51,11 +51,11 @@ export default class Log {
|
|
|
51
51
|
if (!options)
|
|
52
52
|
return;
|
|
53
53
|
if (typeof options !== 'object')
|
|
54
|
-
throw 'The options param must be an object.';
|
|
54
|
+
throw new Error('The options param must be an object.');
|
|
55
55
|
for (const option of Object.keys(options)) {
|
|
56
56
|
if (!optionKeys.includes(option)) {
|
|
57
|
-
throw `${option} is not a valid configuration object.`
|
|
58
|
-
+ '\n For a list of available options, see https://github.com/abofs/stonyx-logs#configuration';
|
|
57
|
+
throw new Error(`${option} is not a valid configuration object.`
|
|
58
|
+
+ '\n For a list of available options, see https://github.com/abofs/stonyx-logs#configuration');
|
|
59
59
|
}
|
|
60
60
|
// sanitize path input
|
|
61
61
|
if (option === 'path') {
|
|
@@ -162,7 +162,7 @@ export default class Log {
|
|
|
162
162
|
const delim = moduleDir.includes('node_modules') ? 'node_modules' : 'src';
|
|
163
163
|
const splitDir = moduleDir.split(delim);
|
|
164
164
|
if (splitDir.length < 2)
|
|
165
|
-
throw ('Failed to locate your project\'s root directory.');
|
|
165
|
+
throw new Error('Failed to locate your project\'s root directory.');
|
|
166
166
|
// use project root directory behind path
|
|
167
167
|
path = projectPath.resolve(splitDir[0], path);
|
|
168
168
|
// force path property to contain a trailing "/"
|