@jdeighan/coffee-utils 5.0.4 → 5.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/log_utils.coffee +8 -3
- package/src/log_utils.js +10 -3
package/package.json
CHANGED
package/src/log_utils.coffee
CHANGED
@@ -4,7 +4,7 @@ import yaml from 'js-yaml'
|
|
4
4
|
|
5
5
|
import {
|
6
6
|
assert, undef, isNumber, isInteger, isString, isHash, isFunction,
|
7
|
-
escapeStr, sep_eq,
|
7
|
+
escapeStr, sep_eq, sep_dash
|
8
8
|
} from '@jdeighan/coffee-utils'
|
9
9
|
import {blockToArray} from '@jdeighan/coffee-utils/block'
|
10
10
|
import {tabify, untabify} from '@jdeighan/coffee-utils/indent'
|
@@ -17,9 +17,14 @@ export id = 42
|
|
17
17
|
# ---------------------------------------------------------------------------
|
18
18
|
# This is useful for debugging and easy to remove after debugging
|
19
19
|
|
20
|
-
export LOG = (
|
20
|
+
export LOG = (item, label, ch='=') ->
|
21
21
|
|
22
|
-
|
22
|
+
if label
|
23
|
+
console.log ch.repeat(42)
|
24
|
+
console.log "[#{label}]:"
|
25
|
+
console.log untabify(orderedStringify(item))
|
26
|
+
else
|
27
|
+
console.log item
|
23
28
|
return
|
24
29
|
|
25
30
|
# ---------------------------------------------------------------------------
|
package/src/log_utils.js
CHANGED
@@ -13,7 +13,8 @@ import {
|
|
13
13
|
isHash,
|
14
14
|
isFunction,
|
15
15
|
escapeStr,
|
16
|
-
sep_eq
|
16
|
+
sep_eq,
|
17
|
+
sep_dash
|
17
18
|
} from '@jdeighan/coffee-utils';
|
18
19
|
|
19
20
|
import {
|
@@ -34,8 +35,14 @@ export var id = 42;
|
|
34
35
|
|
35
36
|
// ---------------------------------------------------------------------------
|
36
37
|
// This is useful for debugging and easy to remove after debugging
|
37
|
-
export var LOG = function(
|
38
|
-
|
38
|
+
export var LOG = function(item, label, ch = '=') {
|
39
|
+
if (label) {
|
40
|
+
console.log(ch.repeat(42));
|
41
|
+
console.log(`[${label}]:`);
|
42
|
+
console.log(untabify(orderedStringify(item)));
|
43
|
+
} else {
|
44
|
+
console.log(item);
|
45
|
+
}
|
39
46
|
};
|
40
47
|
|
41
48
|
// ---------------------------------------------------------------------------
|