@jdeighan/coffee-utils 7.0.25 → 7.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/block_utils.coffee +1 -1
- package/src/block_utils.js +4 -3
- package/src/coffee_utils.coffee +15 -3
- package/src/coffee_utils.js +13 -3
- package/src/debug_utils.coffee +1 -1
- package/src/debug_utils.js +1 -1
package/package.json
CHANGED
package/src/block_utils.coffee
CHANGED
@@ -84,7 +84,7 @@ export truncateBlock = (str, numLines) ->
|
|
84
84
|
export joinBlocks = (lBlocks...) ->
|
85
85
|
|
86
86
|
lNonEmptyBlocks = []
|
87
|
-
for block in lBlocks
|
87
|
+
for block in lBlocks.flat(999)
|
88
88
|
assert isString(block), "joinBlocks(): #{block} is not a string"
|
89
89
|
if nonEmpty(block)
|
90
90
|
lNonEmptyBlocks.push block
|
package/src/block_utils.js
CHANGED
@@ -101,10 +101,11 @@ export var truncateBlock = function(str, numLines) {
|
|
101
101
|
|
102
102
|
// ---------------------------------------------------------------------------
|
103
103
|
export var joinBlocks = function(...lBlocks) {
|
104
|
-
var block, i, lNonEmptyBlocks, len1;
|
104
|
+
var block, i, lNonEmptyBlocks, len1, ref;
|
105
105
|
lNonEmptyBlocks = [];
|
106
|
-
|
107
|
-
|
106
|
+
ref = lBlocks.flat(999);
|
107
|
+
for (i = 0, len1 = ref.length; i < len1; i++) {
|
108
|
+
block = ref[i];
|
108
109
|
assert(isString(block), `joinBlocks(): ${block} is not a string`);
|
109
110
|
if (nonEmpty(block)) {
|
110
111
|
lNonEmptyBlocks.push(block);
|
package/src/coffee_utils.coffee
CHANGED
@@ -396,8 +396,20 @@ export replaceVars = (line, hVars={}, rx=/__(env\.)?([A-Za-z_]\w*)__/g) ->
|
|
396
396
|
|
397
397
|
# ---------------------------------------------------------------------------
|
398
398
|
|
399
|
-
export
|
399
|
+
export defined = (obj) ->
|
400
400
|
|
401
|
-
|
401
|
+
return (obj != undef) && (obj != null)
|
402
|
+
|
403
|
+
# ---------------------------------------------------------------------------
|
404
|
+
|
405
|
+
export notdefined = (obj) ->
|
406
|
+
|
407
|
+
return (obj == undef) || (obj == null)
|
408
|
+
|
409
|
+
# ---------------------------------------------------------------------------
|
410
|
+
|
411
|
+
export isIterable = (obj) ->
|
412
|
+
|
413
|
+
if (obj == undef) || (obj == null)
|
402
414
|
return false
|
403
|
-
return typeof
|
415
|
+
return typeof obj[Symbol.iterator] == 'function'
|
package/src/coffee_utils.js
CHANGED
@@ -430,9 +430,19 @@ export var replaceVars = function(line, hVars = {}, rx = /__(env\.)?([A-Za-z_]\w
|
|
430
430
|
};
|
431
431
|
|
432
432
|
// ---------------------------------------------------------------------------
|
433
|
-
export var
|
434
|
-
|
433
|
+
export var defined = function(obj) {
|
434
|
+
return (obj !== undef) && (obj !== null);
|
435
|
+
};
|
436
|
+
|
437
|
+
// ---------------------------------------------------------------------------
|
438
|
+
export var notdefined = function(obj) {
|
439
|
+
return (obj === undef) || (obj === null);
|
440
|
+
};
|
441
|
+
|
442
|
+
// ---------------------------------------------------------------------------
|
443
|
+
export var isIterable = function(obj) {
|
444
|
+
if ((obj === undef) || (obj === null)) {
|
435
445
|
return false;
|
436
446
|
}
|
437
|
-
return typeof
|
447
|
+
return typeof obj[Symbol.iterator] === 'function';
|
438
448
|
};
|
package/src/debug_utils.coffee
CHANGED