ducktyper
Version:
A tool for validating input based on the fundamental js idea of duck typing. The object of this is to allow for clearer input validation and specification from the perspective of the developer. It will reduce the amount of time it takes to do input valida
16 lines (15 loc) • 502 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// Import isDuck function from your module
var isDuck = require("./isDuck");
// Define isClass function
function isClass(cls) {
console.warn(cls.name);
// Check if the name starts with an uppercase letter (assumes class naming convention)
if (/^[A-Z].*$/.test(cls.name)) {
return true;
}
// If all checks fail, assume it's not a class
return false;
}
exports.default = isClass;