UNPKG
stepdad
Version:
latest (1.0.2-3)
next (1.0.2-2)
1.0.2-3
1.0.2-2
1.0.2-1
1.0.2-0
1.0.1
Stupid simple and lightweight dependency injection
github.com/mikro/stepdad
mikro/stepdad
stepdad
/
src
/
container
/
dad.ts
10 lines
(7 loc)
•
276 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
import
{
Type
}
from
'../interfaces/Type'
import
{
Injector
}
from
'./Injector'
export
const
dad = <T>(
target
:
Type
<
any
>): [T,
() =>
void
] => {
const
injector =
new
Injector
()
const
entryClass = injector.
resolve
<T>(target)
return
[entryClass,
() =>
injector.
release
()] }