@jdeighan/coffee-utils 10.0.3 → 10.0.4
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 +6 -1
- package/src/log_utils.js +8 -2
package/package.json
CHANGED
package/src/log_utils.coffee
CHANGED
@@ -183,7 +183,12 @@ export logItem = (label, item, pre='', itemPre=undef) ->
|
|
183
183
|
putstr "#{pre}#{labelStr}#{item}"
|
184
184
|
else if isString(item)
|
185
185
|
if (item.length <= maxOneLine)
|
186
|
-
|
186
|
+
result = escapeStr(item)
|
187
|
+
hasApos = (result.indexOf("'") >= 0)
|
188
|
+
if hasApos
|
189
|
+
putstr "#{pre}#{labelStr}\"#{result}\""
|
190
|
+
else
|
191
|
+
putstr "#{pre}#{labelStr}'#{result}'"
|
187
192
|
else
|
188
193
|
if label
|
189
194
|
putstr "#{pre}#{label}:"
|
package/src/log_utils.js
CHANGED
@@ -184,7 +184,7 @@ export var logBareItem = function(item, pre = '') {
|
|
184
184
|
|
185
185
|
// ---------------------------------------------------------------------------
|
186
186
|
export var logItem = function(label, item, pre = '', itemPre = undef) {
|
187
|
-
var i, labelStr, len, ref, str;
|
187
|
+
var hasApos, i, labelStr, len, ref, result, str;
|
188
188
|
assert(isString(pre), `not a string: ${OL(pre)}`);
|
189
189
|
assert(isFunction(putstr), "putstr not properly set");
|
190
190
|
assert(!label || isString(label), "label a non-string");
|
@@ -207,7 +207,13 @@ export var logItem = function(label, item, pre = '', itemPre = undef) {
|
|
207
207
|
putstr(`${pre}${labelStr}${item}`);
|
208
208
|
} else if (isString(item)) {
|
209
209
|
if (item.length <= maxOneLine) {
|
210
|
-
|
210
|
+
result = escapeStr(item);
|
211
|
+
hasApos = result.indexOf("'") >= 0;
|
212
|
+
if (hasApos) {
|
213
|
+
putstr(`${pre}${labelStr}\"${result}\"`);
|
214
|
+
} else {
|
215
|
+
putstr(`${pre}${labelStr}'${result}'`);
|
216
|
+
}
|
211
217
|
} else {
|
212
218
|
if (label) {
|
213
219
|
putstr(`${pre}${label}:`);
|