@jdeighan/coffee-utils 7.0.36 → 7.0.39
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/indent_utils.coffee +2 -2
- package/src/indent_utils.js +2 -2
- package/src/log_utils.coffee +5 -1
- package/src/log_utils.js +6 -1
package/package.json
CHANGED
package/src/indent_utils.coffee
CHANGED
@@ -13,8 +13,8 @@ import {arrayToBlock, blockToArray} from '@jdeighan/coffee-utils/block'
|
|
13
13
|
|
14
14
|
export splitLine = (line) ->
|
15
15
|
|
16
|
-
assert line
|
17
|
-
assert isString(line), "splitLine(): line
|
16
|
+
assert defined(line), "splitLine(): line is undef"
|
17
|
+
assert isString(line), "splitLine(): non-string #{OL(line)}"
|
18
18
|
line = rtrim(line)
|
19
19
|
lMatches = line.match(/^(\s*)(.*)$/)
|
20
20
|
return [lMatches[1].length, lMatches[2]]
|
package/src/indent_utils.js
CHANGED
@@ -25,8 +25,8 @@ import {
|
|
25
25
|
// splitLine - separate a line into [level, line]
|
26
26
|
export var splitLine = function(line) {
|
27
27
|
var lMatches;
|
28
|
-
assert(line
|
29
|
-
assert(isString(line),
|
28
|
+
assert(defined(line), "splitLine(): line is undef");
|
29
|
+
assert(isString(line), `splitLine(): non-string ${OL(line)}`);
|
30
30
|
line = rtrim(line);
|
31
31
|
lMatches = line.match(/^(\s*)(.*)$/);
|
32
32
|
return [lMatches[1].length, lMatches[2]];
|
package/src/log_utils.coffee
CHANGED
@@ -22,8 +22,10 @@ export LOG = (lArgs...) ->
|
|
22
22
|
[label, item] = lArgs
|
23
23
|
if lArgs.length > 1
|
24
24
|
# --- There's both a label and an item
|
25
|
-
if
|
25
|
+
if (item == undef)
|
26
26
|
console.log "#{label}: UNDEFINED"
|
27
|
+
else if (item == null)
|
28
|
+
console.log "#{label}: NULL"
|
27
29
|
else
|
28
30
|
console.log sep_dash
|
29
31
|
console.log "#{label}:"
|
@@ -152,6 +154,8 @@ export logItem = (label, item, hOptions={}) ->
|
|
152
154
|
|
153
155
|
if (item == undef)
|
154
156
|
putstr "#{prefix}#{labelStr}undef"
|
157
|
+
else if (item == null)
|
158
|
+
putstr "#{prefix}#{labelStr}null"
|
155
159
|
else if isString(item)
|
156
160
|
if (item.length <= maxOneLine)
|
157
161
|
putstr "#{prefix}#{labelStr}'#{escapeStr(item)}'"
|
package/src/log_utils.js
CHANGED
@@ -39,8 +39,11 @@ export var LOG = function(...lArgs) {
|
|
39
39
|
var item, label;
|
40
40
|
[label, item] = lArgs;
|
41
41
|
if (lArgs.length > 1) {
|
42
|
-
|
42
|
+
// --- There's both a label and an item
|
43
|
+
if (item === undef) {
|
43
44
|
console.log(`${label}: UNDEFINED`);
|
45
|
+
} else if (item === null) {
|
46
|
+
console.log(`${label}: NULL`);
|
44
47
|
} else {
|
45
48
|
console.log(sep_dash);
|
46
49
|
console.log(`${label}:`);
|
@@ -168,6 +171,8 @@ export var logItem = function(label, item, hOptions = {}) {
|
|
168
171
|
labelStr = label ? `${label} = ` : "";
|
169
172
|
if (item === undef) {
|
170
173
|
putstr(`${prefix}${labelStr}undef`);
|
174
|
+
} else if (item === null) {
|
175
|
+
putstr(`${prefix}${labelStr}null`);
|
171
176
|
} else if (isString(item)) {
|
172
177
|
if (item.length <= maxOneLine) {
|
173
178
|
putstr(`${prefix}${labelStr}'${escapeStr(item)}'`);
|