@automapper/classes
Advanced tools
Comparing version 1.0.0-beta.9 to 1.0.0
{ | ||
"name": "@automapper/classes", | ||
"version": "1.0.0-beta.9", | ||
"version": "1.0.0", | ||
"peerDependencies": { | ||
"reflect-metadata": "~0.1.13", | ||
"@automapper/core": "1.0.0-beta.9", | ||
"@automapper/types": "1.0.0-beta.9" | ||
"@automapper/core": "1.0.0", | ||
"@automapper/types": "1.0.0" | ||
}, | ||
@@ -9,0 +9,0 @@ "sideEffects": false, |
@@ -6,2 +6,2 @@ /** | ||
*/ | ||
export declare function isClass(fn: unknown): boolean; | ||
export declare function isClass(fn: Function): boolean; |
@@ -9,13 +9,15 @@ "use strict"; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function isClass(fn) { | ||
var _a; | ||
var _a, _b; | ||
const typeOfFn = typeof fn; | ||
const constructorFnString = (_a = fn.constructor) === null || _a === void 0 ? void 0 : _a.toString(); | ||
return ((typeOfFn === 'object' || typeOfFn === 'function') && | ||
fn.constructor && | ||
(/^\s*function/.test(constructorFnString) || | ||
/^\s*class/.test(constructorFnString)) && | ||
constructorFnString.includes(fn.constructor.name)); | ||
const fnString = fn.toString(); | ||
const constructorFnString = (_b = (_a = fn.prototype) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.toString(); | ||
return (typeOfFn === 'function' && | ||
!!constructorFnString && | ||
(/^\s*function/.test(fnString) || /^\s*class/.test(fnString)) && | ||
!!fn.name && | ||
fnString.includes(fn.name)); | ||
} | ||
exports.isClass = isClass; | ||
//# sourceMappingURL=is-class.util.js.map |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41897
608
1