ioc-service-container
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -8,2 +8,8 @@ # Changelog | ||
## [1.5.1] - 2021-07.29 | ||
### Fixed | ||
* Fixed an error in ServiceContainer.set() which not detected constructable classes | ||
## [1.5.0] - 2021-07.29 | ||
@@ -10,0 +16,0 @@ |
@@ -17,3 +17,3 @@ "use strict"; | ||
let factory = undefined; | ||
if (isClassReference(factoryOrClassReference)) { | ||
if (isConstructable(factoryOrClassReference)) { | ||
factory = () => new factoryOrClassReference(); | ||
@@ -52,4 +52,4 @@ } | ||
}; | ||
function isClassReference(v) { | ||
return typeof v === 'function' && /^\s*class\s+/.test(v.toString()); | ||
function isConstructable(obj) { | ||
return !!obj.prototype && !!obj.prototype.constructor.name; | ||
} |
{ | ||
"name": "ioc-service-container", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Lightweight ioc service container", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15061