Skip to content

Commit

Permalink
#comment add condition to unbind undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
tareksaleem committed Sep 4, 2023
1 parent fa31244 commit 882f08e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "injectx",
"version": "1.0.3",
"version": "1.0.4",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
5 changes: 4 additions & 1 deletion src/injectX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export class Container {
service: Constructable<T> | T,
options: IDIServiceOptions = {},
) {
const key = options.name || (service as any).name;
if (service === undefined) {
return this;
}
const key = options.name || (service as any)?.name;
const injectableType = getInjectableType(service);
const settings: IDependency<T> = {
name: key,
Expand Down

0 comments on commit 882f08e

Please sign in to comment.