@jdeighan/coffee-utils 5.0.3 → 6.0.0
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 +15 -1
- package/src/log_utils.js +15 -1
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'
|
@@ -14,6 +14,20 @@ logger = undef
|
|
14
14
|
export stringify = undef
|
15
15
|
export id = 42
|
16
16
|
|
17
|
+
# ---------------------------------------------------------------------------
|
18
|
+
# This is useful for debugging and easy to remove after debugging
|
19
|
+
|
20
|
+
export LOG = (label, item, ch='=') ->
|
21
|
+
|
22
|
+
if item
|
23
|
+
console.log ch.repeat(42)
|
24
|
+
console.log "[#{label}]:"
|
25
|
+
console.log untabify(orderedStringify(item))
|
26
|
+
console.log ch.repeat(42)
|
27
|
+
else
|
28
|
+
console.log label
|
29
|
+
return
|
30
|
+
|
17
31
|
# ---------------------------------------------------------------------------
|
18
32
|
|
19
33
|
export setStringifier = (func) ->
|
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 {
|
@@ -32,6 +33,19 @@ export var stringify = undef;
|
|
32
33
|
|
33
34
|
export var id = 42;
|
34
35
|
|
36
|
+
// ---------------------------------------------------------------------------
|
37
|
+
// This is useful for debugging and easy to remove after debugging
|
38
|
+
export var LOG = function(label, item, ch = '=') {
|
39
|
+
if (item) {
|
40
|
+
console.log(ch.repeat(42));
|
41
|
+
console.log(`[${label}]:`);
|
42
|
+
console.log(untabify(orderedStringify(item)));
|
43
|
+
console.log(ch.repeat(42));
|
44
|
+
} else {
|
45
|
+
console.log(label);
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
35
49
|
// ---------------------------------------------------------------------------
|
36
50
|
export var setStringifier = function(func) {
|
37
51
|
var orgStringifier;
|