added unit testing, and started implementing unit tests...phew
This commit is contained in:
22
node_modules/@sinonjs/samsam/lib/get-class-name.js
generated
vendored
Normal file
22
node_modules/@sinonjs/samsam/lib/get-class-name.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
var re = /function (\w+)\s*\(/;
|
||||
|
||||
function getClassName(value) {
|
||||
if (value.constructor && "name" in value.constructor) {
|
||||
return value.constructor.name;
|
||||
}
|
||||
|
||||
if (typeof value.constructor === "function") {
|
||||
var match = valueToString(value.constructor).match(re);
|
||||
if (match.length > 1) {
|
||||
return match[1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = getClassName;
|
Reference in New Issue
Block a user