@jdeighan/coffee-utils 7.0.26 → 7.0.29
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/coffee_utils.coffee +24 -3
- package/src/coffee_utils.js +23 -3
- package/src/debug_utils.coffee +1 -1
- package/src/debug_utils.js +1 -1
package/package.json
CHANGED
package/src/coffee_utils.coffee
CHANGED
@@ -396,8 +396,29 @@ 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'
|
416
|
+
|
417
|
+
# ---------------------------------------------------------------------------
|
418
|
+
|
419
|
+
export className = (aClass) ->
|
420
|
+
|
421
|
+
if lMatches = aClass.toString().match(/class\s+(\w+)/)
|
422
|
+
return lMatches[1]
|
423
|
+
else
|
424
|
+
croak "className(): Bad input class"
|
package/src/coffee_utils.js
CHANGED
@@ -430,9 +430,29 @@ 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';
|
448
|
+
};
|
449
|
+
|
450
|
+
// ---------------------------------------------------------------------------
|
451
|
+
export var className = function(aClass) {
|
452
|
+
var lMatches;
|
453
|
+
if (lMatches = aClass.toString().match(/class\s+(\w+)/)) {
|
454
|
+
return lMatches[1];
|
455
|
+
} else {
|
456
|
+
return croak("className(): Bad input class");
|
457
|
+
}
|
438
458
|
};
|
package/src/debug_utils.coffee
CHANGED