@jdeighan/coffee-utils 7.0.28 → 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 +9 -0
- package/src/coffee_utils.js +10 -0
package/package.json
CHANGED
package/src/coffee_utils.coffee
CHANGED
@@ -413,3 +413,12 @@ export isIterable = (obj) ->
|
|
413
413
|
if (obj == undef) || (obj == null)
|
414
414
|
return false
|
415
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
@@ -446,3 +446,13 @@ export var isIterable = function(obj) {
|
|
446
446
|
}
|
447
447
|
return typeof obj[Symbol.iterator] === 'function';
|
448
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
|
+
}
|
458
|
+
};
|