@jdeighan/coffee-utils 7.0.43 → 7.0.46
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/debug_utils.coffee +1 -1
- package/src/debug_utils.js +2 -0
- package/src/indent_utils.coffee +2 -2
- package/src/indent_utils.js +2 -2
- package/src/log_utils.coffee +3 -3
- package/src/log_utils.js +5 -0
package/package.json
CHANGED
package/src/debug_utils.coffee
CHANGED
@@ -196,7 +196,7 @@ export debug = (lArgs...) ->
|
|
196
196
|
if doDebugDebug
|
197
197
|
trans = "#{orgDebugging} => #{debugging}"
|
198
198
|
LOG " Restore hEnv: debugging: #{trans}"
|
199
|
-
return
|
199
|
+
return true # allow use in boolean expressions
|
200
200
|
|
201
201
|
# ---------------------------------------------------------------------------
|
202
202
|
|
package/src/debug_utils.js
CHANGED
@@ -213,8 +213,10 @@ export var debug = function(...lArgs) {
|
|
213
213
|
LOG(` Restore hEnv: debugging: ${trans}`);
|
214
214
|
}
|
215
215
|
}
|
216
|
+
return true; // allow use in boolean expressions
|
216
217
|
};
|
217
218
|
|
219
|
+
|
218
220
|
// ---------------------------------------------------------------------------
|
219
221
|
reMethod = /^([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)$/;
|
220
222
|
|
package/src/indent_utils.coffee
CHANGED
@@ -78,7 +78,7 @@ export undented = (text, level=undef) ->
|
|
78
78
|
else if isArray(text)
|
79
79
|
lLines = text
|
80
80
|
for line in lLines
|
81
|
-
assert isString(line), "undented():
|
81
|
+
assert isString(line), "undented(): array not all strings"
|
82
82
|
if (lLines.length == 0)
|
83
83
|
return []
|
84
84
|
else
|
@@ -91,7 +91,7 @@ export undented = (text, level=undef) ->
|
|
91
91
|
else
|
92
92
|
lMatches = lLines[0].match(/^\s*/)
|
93
93
|
toRemove = lMatches[0]
|
94
|
-
nToRemove = toRemove
|
94
|
+
nToRemove = indentLevel(toRemove)
|
95
95
|
|
96
96
|
lNewLines = []
|
97
97
|
for line in lLines
|
package/src/indent_utils.js
CHANGED
@@ -99,7 +99,7 @@ export var undented = function(text, level = undef) {
|
|
99
99
|
lLines = text;
|
100
100
|
for (i = 0, len = lLines.length; i < len; i++) {
|
101
101
|
line = lLines[i];
|
102
|
-
assert(isString(line), "undented():
|
102
|
+
assert(isString(line), "undented(): array not all strings");
|
103
103
|
}
|
104
104
|
if (lLines.length === 0) {
|
105
105
|
return [];
|
@@ -115,7 +115,7 @@ export var undented = function(text, level = undef) {
|
|
115
115
|
lMatches = lLines[0].match(/^\s*/);
|
116
116
|
toRemove = lMatches[0];
|
117
117
|
}
|
118
|
-
nToRemove = toRemove
|
118
|
+
nToRemove = indentLevel(toRemove);
|
119
119
|
lNewLines = [];
|
120
120
|
for (j = 0, len1 = lLines.length; j < len1; j++) {
|
121
121
|
line = lLines[j];
|
package/src/log_utils.coffee
CHANGED
@@ -36,7 +36,7 @@ export LOG = (lArgs...) ->
|
|
36
36
|
console.log sep_dash
|
37
37
|
else
|
38
38
|
console.log label
|
39
|
-
return
|
39
|
+
return true # to allow use in boolean expressions
|
40
40
|
|
41
41
|
# --- Use this instead to make it easier to remove all instances
|
42
42
|
export DEBUG = LOG # synonym
|
@@ -135,7 +135,7 @@ export log = (str, hOptions={}) ->
|
|
135
135
|
|
136
136
|
prefix = fixStr(hOptions.prefix)
|
137
137
|
putstr "#{prefix}#{str}"
|
138
|
-
return
|
138
|
+
return true # to allow use in boolean expressions
|
139
139
|
|
140
140
|
# ---------------------------------------------------------------------------
|
141
141
|
|
@@ -173,7 +173,7 @@ export logItem = (label, item, hOptions={}) ->
|
|
173
173
|
putstr "#{prefix}#{indentation(1)}#{fixStr(str)}"
|
174
174
|
putstr "#{prefix}#{sep_dash}"
|
175
175
|
|
176
|
-
return
|
176
|
+
return true
|
177
177
|
|
178
178
|
# ---------------------------------------------------------------------------
|
179
179
|
|
package/src/log_utils.js
CHANGED
@@ -57,8 +57,10 @@ export var LOG = function(...lArgs) {
|
|
57
57
|
} else {
|
58
58
|
console.log(label);
|
59
59
|
}
|
60
|
+
return true; // to allow use in boolean expressions
|
60
61
|
};
|
61
62
|
|
63
|
+
|
62
64
|
// --- Use this instead to make it easier to remove all instances
|
63
65
|
export var DEBUG = LOG; // synonym
|
64
66
|
|
@@ -155,8 +157,10 @@ export var log = function(str, hOptions = {}) {
|
|
155
157
|
assert(isHash(hOptions), "log(): arg 2 not a hash");
|
156
158
|
prefix = fixStr(hOptions.prefix);
|
157
159
|
putstr(`${prefix}${str}`);
|
160
|
+
return true; // to allow use in boolean expressions
|
158
161
|
};
|
159
162
|
|
163
|
+
|
160
164
|
// ---------------------------------------------------------------------------
|
161
165
|
export var logItem = function(label, item, hOptions = {}) {
|
162
166
|
var i, labelStr, len, prefix, ref, str;
|
@@ -197,6 +201,7 @@ export var logItem = function(label, item, hOptions = {}) {
|
|
197
201
|
}
|
198
202
|
putstr(`${prefix}${sep_dash}`);
|
199
203
|
}
|
204
|
+
return true;
|
200
205
|
};
|
201
206
|
|
202
207
|
// ---------------------------------------------------------------------------
|