ditox 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +5 -5
  2. package/dist/{index.d.ts → browser/index.d.ts} +18 -10
  3. package/dist/browser/index.js +2 -0
  4. package/dist/browser/index.js.map +1 -0
  5. package/dist/cjs/ditox.d.ts +125 -0
  6. package/dist/cjs/ditox.js +210 -0
  7. package/dist/cjs/ditox.js.map +1 -0
  8. package/dist/cjs/index.d.ts +5 -0
  9. package/dist/cjs/index.js +22 -0
  10. package/dist/cjs/index.js.map +1 -0
  11. package/dist/cjs/modules.d.ts +124 -0
  12. package/dist/cjs/modules.js +110 -0
  13. package/dist/cjs/modules.js.map +1 -0
  14. package/{src/utils.js.flow → dist/cjs/utils.d.ts} +21 -60
  15. package/dist/cjs/utils.js +98 -0
  16. package/dist/cjs/utils.js.map +1 -0
  17. package/dist/esm/ditox.d.ts +125 -0
  18. package/{lib/index.js → dist/esm/ditox.js} +10 -196
  19. package/dist/esm/ditox.js.map +1 -0
  20. package/dist/esm/index.d.ts +5 -0
  21. package/dist/esm/index.js +4 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/esm/modules.d.ts +124 -0
  24. package/dist/esm/modules.js +103 -0
  25. package/dist/esm/modules.js.map +1 -0
  26. package/dist/esm/utils.d.ts +74 -0
  27. package/dist/esm/utils.js +88 -0
  28. package/dist/esm/utils.js.map +1 -0
  29. package/{lib → dist/umd}/index.d.ts +18 -10
  30. package/dist/umd/index.js +2 -0
  31. package/dist/umd/index.js.map +1 -0
  32. package/docs/.nojekyll +1 -0
  33. package/docs/README.md +113 -96
  34. package/docs/classes/{resolvererror.md → ResolverError.md} +14 -12
  35. package/package.json +16 -17
  36. package/src/ditox.test.ts +10 -1
  37. package/src/index.ts +8 -9
  38. package/src/modules.test.ts +79 -5
  39. package/src/modules.ts +33 -17
  40. package/src/utils.ts +4 -4
  41. package/CHANGELOG.md +0 -99
  42. package/dist/index.browser.js +0 -2
  43. package/dist/index.browser.js.flow +0 -4
  44. package/dist/index.browser.js.map +0 -1
  45. package/dist/index.js +0 -406
  46. package/dist/index.js.flow +0 -4
  47. package/dist/index.js.map +0 -1
  48. package/dist/index.module.d.ts +0 -293
  49. package/dist/index.module.js +0 -388
  50. package/dist/index.module.js.flow +0 -4
  51. package/dist/index.module.js.map +0 -1
  52. package/dist/index.umd.d.ts +0 -293
  53. package/dist/index.umd.js +0 -2
  54. package/dist/index.umd.js.flow +0 -4
  55. package/dist/index.umd.js.map +0 -1
  56. package/lib/index.js.flow +0 -4
  57. package/lib/index.js.map +0 -1
  58. package/mod.ts +0 -2
  59. package/src/ditox.js.flow +0 -131
  60. package/src/index.js.flow +0 -34
  61. package/src/modules.js.flow +0 -146
package/docs/README.md CHANGED
@@ -6,7 +6,7 @@ ditox
6
6
 
7
7
  ### Classes
8
8
 
9
- - [ResolverError](classes/resolvererror.md)
9
+ - [ResolverError](classes/ResolverError.md)
10
10
 
11
11
  ### Type aliases
12
12
 
@@ -56,7 +56,7 @@ Options for module binding.
56
56
 
57
57
  #### Defined in
58
58
 
59
- [packages/ditox/src/modules.ts:73](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L73)
59
+ [packages/ditox/src/modules.ts:83](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L83)
60
60
 
61
61
  ___
62
62
 
@@ -70,23 +70,23 @@ Dependency container.
70
70
 
71
71
  | Name | Type |
72
72
  | :------ | :------ |
73
- | `bindFactory` | <T\>(`token`: [Token](README.md#token)<T\>, `factory`: (`container`: [Container](README.md#container)) => `T`, `options?`: [FactoryOptions](README.md#factoryoptions)<T\>) => `void` |
74
- | `bindValue` | <T\>(`token`: [Token](README.md#token)<T\>, `value`: `T`) => `void` |
75
- | `get` | <T\>(`token`: [Token](README.md#token)<T\>) => `undefined` \| `T` |
76
- | `hasToken` | (`token`: [Token](README.md#token)<unknown\>) => `boolean` |
77
- | `remove` | <T\>(`token`: [Token](README.md#token)<T\>) => `void` |
73
+ | `bindFactory` | <T\>(`token`: [`Token`](README.md#token)<`T`\>, `factory`: (`container`: [`Container`](README.md#container)) => `T`, `options?`: [`FactoryOptions`](README.md#factoryoptions)<`T`\>) => `void` |
74
+ | `bindValue` | <T\>(`token`: [`Token`](README.md#token)<`T`\>, `value`: `T`) => `void` |
75
+ | `get` | <T\>(`token`: [`Token`](README.md#token)<`T`\>) => `undefined` \| `T` |
76
+ | `hasToken` | (`token`: [`Token`](README.md#token)<`unknown`\>) => `boolean` |
77
+ | `remove` | <T\>(`token`: [`Token`](README.md#token)<`T`\>) => `void` |
78
78
  | `removeAll` | () => `void` |
79
- | `resolve` | <T\>(`token`: [Token](README.md#token)<T\>) => `T` |
79
+ | `resolve` | <T\>(`token`: [`Token`](README.md#token)<`T`\>) => `T` |
80
80
 
81
81
  #### Defined in
82
82
 
83
- [packages/ditox/src/ditox.ts:95](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L95)
83
+ [packages/ditox/src/ditox.ts:95](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L95)
84
84
 
85
85
  ___
86
86
 
87
87
  ### FactoryOptions
88
88
 
89
- Ƭ **FactoryOptions**<T\>: { `onRemoved?`: (`value`: `T`) => `void` ; `scope?`: ``"scoped"`` \| ``"singleton"`` } \| { `scope`: ``"transient"`` }
89
+ Ƭ **FactoryOptions**<`T`\>: { `scope?`: ``"scoped"`` \| ``"singleton"`` ; `onRemoved?`: (`value`: `T`) => `void` } \| { `scope`: ``"transient"`` }
90
90
 
91
91
  Options for factory binding.
92
92
 
@@ -105,7 +105,7 @@ Options for factory binding.
105
105
 
106
106
  #### Defined in
107
107
 
108
- [packages/ditox/src/ditox.ts:83](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L83)
108
+ [packages/ditox/src/ditox.ts:83](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L83)
109
109
 
110
110
  ___
111
111
 
@@ -117,13 +117,13 @@ ___
117
117
 
118
118
  #### Defined in
119
119
 
120
- [packages/ditox/src/ditox.ts:71](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L71)
120
+ [packages/ditox/src/ditox.ts:71](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L71)
121
121
 
122
122
  ___
123
123
 
124
124
  ### Module
125
125
 
126
- Ƭ **Module**<ModuleProps\>: `ModuleController` & `ModuleProps`
126
+ Ƭ **Module**<`ModuleProps`\>: `ModuleController` & `ModuleProps`
127
127
 
128
128
  Dependency module
129
129
 
@@ -138,27 +138,27 @@ type LoggerModule = Module<{
138
138
 
139
139
  | Name | Type |
140
140
  | :------ | :------ |
141
- | `ModuleProps` | `ModuleProps`: `AnyObject` = `EmptyObject` |
141
+ | `ModuleProps` | extends `AnyObject` = `EmptyObject` |
142
142
 
143
143
  #### Defined in
144
144
 
145
- [packages/ditox/src/modules.ts:22](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L22)
145
+ [packages/ditox/src/modules.ts:22](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L22)
146
146
 
147
147
  ___
148
148
 
149
149
  ### ModuleBindingEntry
150
150
 
151
- Ƭ **ModuleBindingEntry**: [ModuleDeclaration](README.md#moduledeclaration)<AnyObject\> \| { `module`: [ModuleDeclaration](README.md#moduledeclaration)<AnyObject\> ; `options`: [BindModuleOptions](README.md#bindmoduleoptions) }
151
+ Ƭ **ModuleBindingEntry**: [`ModuleDeclaration`](README.md#moduledeclaration)<`AnyObject`\> \| { `module`: [`ModuleDeclaration`](README.md#moduledeclaration)<`AnyObject`\> ; `options`: [`BindModuleOptions`](README.md#bindmoduleoptions) }
152
152
 
153
153
  #### Defined in
154
154
 
155
- [packages/ditox/src/modules.ts:137](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L137)
155
+ [packages/ditox/src/modules.ts:87](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L87)
156
156
 
157
157
  ___
158
158
 
159
159
  ### ModuleDeclaration
160
160
 
161
- Ƭ **ModuleDeclaration**<T\>: `Object`
161
+ Ƭ **ModuleDeclaration**<`T`\>: `Object`
162
162
 
163
163
  Description how to bind the module in declarative way.
164
164
 
@@ -173,7 +173,7 @@ const LOGGER_MODULE: ModuleDeclaration<LoggerModule> = {
173
173
  destroy: () => transport.close(),
174
174
  }
175
175
  },
176
- exportedProps: {
176
+ exports: {
177
177
  logger: LOGGER_TOKEN,
178
178
  },
179
179
  };
@@ -183,27 +183,29 @@ const LOGGER_MODULE: ModuleDeclaration<LoggerModule> = {
183
183
 
184
184
  | Name | Type |
185
185
  | :------ | :------ |
186
- | `T` | `T`: [Module](README.md#module)<AnyObject\> |
186
+ | `T` | extends [`Module`](README.md#module)<`AnyObject`\> |
187
187
 
188
188
  #### Type declaration
189
189
 
190
190
  | Name | Type | Description |
191
191
  | :------ | :------ | :------ |
192
- | `afterBinding?` | (`container`: [Container](README.md#container)) => `void` | - |
193
- | `beforeBinding?` | (`container`: [Container](README.md#container)) => `void` | - |
194
- | `exportedProps?` | { [K in keyof GetModuleProps<T\>]?: Token<GetModuleProps<T\>[K]\>} | Dictionary of module properties which are bound to tokens. |
195
- | `factory` | (`container`: [Container](README.md#container)) => `T` | - |
196
- | `token` | [Token](README.md#token)<T\> | Token for the module |
192
+ | `exportedProps?` | [`ModuleDeclaration`](README.md#moduledeclaration)<`T`\>[``"exports"``] | Dictionary of module properties which are bound to tokens. **`deprecated`** Use `exports` property. |
193
+ | `exports?` | { [K in keyof GetModuleProps<T\>]?: Token<GetModuleProps<T\>[K]\> } | Dictionary of module properties which are bound to tokens. |
194
+ | `imports?` | `ReadonlyArray`<[`ModuleBindingEntry`](README.md#modulebindingentry)\> | Modules for binding |
195
+ | `token` | [`Token`](README.md#token)<`T`\> | Token for the module |
196
+ | `afterBinding?` | (`container`: [`Container`](README.md#container)) => `void` | Callback could be used to export complex dependencies from the module. It is called after binding the module. |
197
+ | `beforeBinding?` | (`container`: [`Container`](README.md#container)) => `void` | Callback could be used to prepare an environment. It is called before binding the module. |
198
+ | `factory` | (`container`: [`Container`](README.md#container)) => `T` | Factory of the module |
197
199
 
198
200
  #### Defined in
199
201
 
200
- [packages/ditox/src/modules.ts:47](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L47)
202
+ [packages/ditox/src/modules.ts:47](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L47)
201
203
 
202
204
  ___
203
205
 
204
206
  ### Token
205
207
 
206
- Ƭ **Token**<T\>: `RequiredToken`<T\> \| `OptionalToken`<T\>
208
+ Ƭ **Token**<`T`\>: `RequiredToken`<`T`\> \| `OptionalToken`<`T`\>
207
209
 
208
210
  Binding token.
209
211
 
@@ -215,13 +217,13 @@ Binding token.
215
217
 
216
218
  #### Defined in
217
219
 
218
- [packages/ditox/src/ditox.ts:25](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L25)
220
+ [packages/ditox/src/ditox.ts:25](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L25)
219
221
 
220
222
  ## Functions
221
223
 
222
224
  ### bindModule
223
225
 
224
- ▸ **bindModule**<T\>(`container`, `moduleDeclaration`, `options?`): `void`
226
+ ▸ **bindModule**<`T`\>(`container`, `moduleDeclaration`, `options?`): `void`
225
227
 
226
228
  Binds the dependency module to the container
227
229
 
@@ -234,15 +236,15 @@ bindModule(container, LOGGER_MODULE);
234
236
 
235
237
  | Name | Type |
236
238
  | :------ | :------ |
237
- | `T` | `T`: [Module](README.md#module)<AnyObject\> |
239
+ | `T` | extends [`Module`](README.md#module)<`AnyObject`\> |
238
240
 
239
241
  #### Parameters
240
242
 
241
243
  | Name | Type | Description |
242
244
  | :------ | :------ | :------ |
243
- | `container` | [Container](README.md#container) | Dependency container. |
244
- | `moduleDeclaration` | [ModuleDeclaration](README.md#moduledeclaration)<T\> | Declaration of the dependency module. |
245
- | `options?` | [BindModuleOptions](README.md#bindmoduleoptions) | Options for module binding. |
245
+ | `container` | [`Container`](README.md#container) | Dependency container. |
246
+ | `moduleDeclaration` | [`ModuleDeclaration`](README.md#moduledeclaration)<`T`\> | Declaration of the dependency module. |
247
+ | `options?` | [`BindModuleOptions`](README.md#bindmoduleoptions) | Options for module binding. |
246
248
 
247
249
  #### Returns
248
250
 
@@ -250,7 +252,7 @@ bindModule(container, LOGGER_MODULE);
250
252
 
251
253
  #### Defined in
252
254
 
253
- [packages/ditox/src/modules.ts:88](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L88)
255
+ [packages/ditox/src/modules.ts:105](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L105)
254
256
 
255
257
  ___
256
258
 
@@ -264,8 +266,8 @@ Binds dependency modules to the container
264
266
 
265
267
  | Name | Type | Description |
266
268
  | :------ | :------ | :------ |
267
- | `container` | [Container](README.md#container) | Dependency container for binding |
268
- | `modules` | [ModuleBindingEntry](README.md#modulebindingentry)[] | Array of module binding entries: module declaration or `{module: ModuleDeclaration, options: BindModuleOptions}` objects. |
269
+ | `container` | [`Container`](README.md#container) | Dependency container for binding |
270
+ | `modules` | readonly [`ModuleBindingEntry`](README.md#modulebindingentry)[] | Array of module binding entries: module declaration or `{module: ModuleDeclaration, options: BindModuleOptions}` objects. |
269
271
 
270
272
  #### Returns
271
273
 
@@ -273,13 +275,13 @@ Binds dependency modules to the container
273
275
 
274
276
  #### Defined in
275
277
 
276
- [packages/ditox/src/modules.ts:150](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L150)
278
+ [packages/ditox/src/modules.ts:166](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L166)
277
279
 
278
280
  ___
279
281
 
280
282
  ### bindMultiValue
281
283
 
282
- ▸ **bindMultiValue**<T\>(`container`, `token`, `value`): `void`
284
+ ▸ **bindMultiValue**<`T`\>(`container`, `token`, `value`): `void`
283
285
 
284
286
  Rebinds the array by the token with added new value.
285
287
 
@@ -293,8 +295,8 @@ Rebinds the array by the token with added new value.
293
295
 
294
296
  | Name | Type | Description |
295
297
  | :------ | :------ | :------ |
296
- | `container` | [Container](README.md#container) | Dependency container. |
297
- | `token` | [Token](README.md#token)<T[]\> | Token for an array of values. |
298
+ | `container` | [`Container`](README.md#container) | Dependency container. |
299
+ | `token` | [`Token`](README.md#token)<readonly `T`[]\> | Token for an array of values. |
298
300
  | `value` | `T` | New value which is added to the end of the array. |
299
301
 
300
302
  #### Returns
@@ -303,13 +305,13 @@ Rebinds the array by the token with added new value.
303
305
 
304
306
  #### Defined in
305
307
 
306
- [packages/ditox/src/utils.ts:14](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L14)
308
+ [packages/ditox/src/utils.ts:14](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L14)
307
309
 
308
310
  ___
309
311
 
310
312
  ### createContainer
311
313
 
312
- ▸ **createContainer**(`parentContainer?`): [Container](README.md#container)
314
+ ▸ **createContainer**(`parentContainer?`): [`Container`](README.md#container)
313
315
 
314
316
  Creates a new dependency container.
315
317
 
@@ -319,21 +321,21 @@ Container can have an optional parent to chain token resolution. The parent is u
319
321
 
320
322
  | Name | Type | Description |
321
323
  | :------ | :------ | :------ |
322
- | `parentContainer?` | [Container](README.md#container) | Optional parent container. |
324
+ | `parentContainer?` | [`Container`](README.md#container) | Optional parent container. |
323
325
 
324
326
  #### Returns
325
327
 
326
- [Container](README.md#container)
328
+ [`Container`](README.md#container)
327
329
 
328
330
  #### Defined in
329
331
 
330
- [packages/ditox/src/ditox.ts:204](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L204)
332
+ [packages/ditox/src/ditox.ts:204](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L204)
331
333
 
332
334
  ___
333
335
 
334
336
  ### declareModule
335
337
 
336
- ▸ **declareModule**<T\>(`declaration`): [ModuleDeclaration](README.md#moduledeclaration)<T\>
338
+ ▸ **declareModule**<`T`\>(`declaration`): [`ModuleDeclaration`](README.md#moduledeclaration)<`T`\>
337
339
 
338
340
  Declares a module binding
339
341
 
@@ -347,7 +349,7 @@ const LOGGER_MODULE = declareModule<LoggerModule>({
347
349
  destroy: () => transport.close(),
348
350
  }
349
351
  },
350
- exportedProps: {
352
+ exports: {
351
353
  logger: LOGGER_TOKEN,
352
354
  },
353
355
  });
@@ -363,21 +365,21 @@ const LOGGER_MODULE = declareModule<LoggerModule>({
363
365
 
364
366
  | Name | Type | Description |
365
367
  | :------ | :------ | :------ |
366
- | `declaration` | `Omit`<[ModuleDeclaration](README.md#moduledeclaration)<T\>, ``"token"``\> & `Partial`<Pick<[ModuleDeclaration](README.md#moduledeclaration)<T\>, ``"token"``\>\> | a module declaration |
368
+ | `declaration` | `Omit`<[`ModuleDeclaration`](README.md#moduledeclaration)<`T`\>, ``"token"``\> & `Partial`<`Pick`<[`ModuleDeclaration`](README.md#moduledeclaration)<`T`\>, ``"token"``\>\> | a module declaration |
367
369
 
368
370
  #### Returns
369
371
 
370
- [ModuleDeclaration](README.md#moduledeclaration)<T\>
372
+ [`ModuleDeclaration`](README.md#moduledeclaration)<`T`\>
371
373
 
372
374
  #### Defined in
373
375
 
374
- [packages/ditox/src/modules.ts:185](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L185)
376
+ [packages/ditox/src/modules.ts:201](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L201)
375
377
 
376
378
  ___
377
379
 
378
380
  ### declareModuleBindings
379
381
 
380
- ▸ **declareModuleBindings**(`modules`): [ModuleDeclaration](README.md#moduledeclaration)<[Module](README.md#module)\>
382
+ ▸ **declareModuleBindings**(`modules`): [`ModuleDeclaration`](README.md#moduledeclaration)<[`Module`](README.md#module)\>
381
383
 
382
384
  Declares bindings of several modules
383
385
 
@@ -385,21 +387,21 @@ Declares bindings of several modules
385
387
 
386
388
  | Name | Type | Description |
387
389
  | :------ | :------ | :------ |
388
- | `modules` | [ModuleBindingEntry](README.md#modulebindingentry)[] | module declaration entries |
390
+ | `modules` | readonly [`ModuleBindingEntry`](README.md#modulebindingentry)[] | module declaration entries |
389
391
 
390
392
  #### Returns
391
393
 
392
- [ModuleDeclaration](README.md#moduledeclaration)<[Module](README.md#module)\>
394
+ [`ModuleDeclaration`](README.md#moduledeclaration)<[`Module`](README.md#module)\>
393
395
 
394
396
  #### Defined in
395
397
 
396
- [packages/ditox/src/modules.ts:197](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/modules.ts#L197)
398
+ [packages/ditox/src/modules.ts:213](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/modules.ts#L213)
397
399
 
398
400
  ___
399
401
 
400
402
  ### getProps
401
403
 
402
- ▸ **getProps**<Props\>(`container`, `tokens`): `Partial`<Props\>
404
+ ▸ **getProps**<`Props`\>(`container`, `tokens`): `Partial`<`Props`\>
403
405
 
404
406
  Returns an object with resolved properties which are specified by token properties.
405
407
  If a token is not found, then `undefined` value is used.
@@ -414,28 +416,28 @@ console.log(props); // {a: 1, b: 2}
414
416
 
415
417
  | Name | Type |
416
418
  | :------ | :------ |
417
- | `Props` | `Props`: `ValuesProps` |
419
+ | `Props` | extends `ValuesProps` |
418
420
 
419
421
  #### Parameters
420
422
 
421
423
  | Name | Type |
422
424
  | :------ | :------ |
423
- | `container` | [Container](README.md#container) |
424
- | `tokens` | `TokenProps`<Props\> |
425
+ | `container` | [`Container`](README.md#container) |
426
+ | `tokens` | `TokenProps`<`Props`\> |
425
427
 
426
428
  #### Returns
427
429
 
428
- `Partial`<Props\>
430
+ `Partial`<`Props`\>
429
431
 
430
432
  #### Defined in
431
433
 
432
- [packages/ditox/src/utils.ts:83](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L83)
434
+ [packages/ditox/src/utils.ts:83](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L83)
433
435
 
434
436
  ___
435
437
 
436
438
  ### getValues
437
439
 
438
- ▸ **getValues**<Tokens, Values\>(`container`, ...`tokens`): `Values`
440
+ ▸ **getValues**<`Tokens`, `Values`\>(`container`, ...`tokens`): `Values`
439
441
 
440
442
  Returns an array of resolved values by the specified token.
441
443
  If a token is not found, then `undefined` value is used.
@@ -444,14 +446,14 @@ If a token is not found, then `undefined` value is used.
444
446
 
445
447
  | Name | Type |
446
448
  | :------ | :------ |
447
- | `Tokens` | `Tokens`: [Token](README.md#token)<unknown\>[] |
448
- | `Values` | `Values`: { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never} |
449
+ | `Tokens` | extends [`Token`](README.md#token)<`unknown`\>[] |
450
+ | `Values` | extends { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never } |
449
451
 
450
452
  #### Parameters
451
453
 
452
454
  | Name | Type |
453
455
  | :------ | :------ |
454
- | `container` | [Container](README.md#container) |
456
+ | `container` | [`Container`](README.md#container) |
455
457
  | `...tokens` | `Tokens` |
456
458
 
457
459
  #### Returns
@@ -460,13 +462,13 @@ If a token is not found, then `undefined` value is used.
460
462
 
461
463
  #### Defined in
462
464
 
463
- [packages/ditox/src/utils.ts:28](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L28)
465
+ [packages/ditox/src/utils.ts:28](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L28)
464
466
 
465
467
  ___
466
468
 
467
469
  ### injectable
468
470
 
469
- ▸ **injectable**<Tokens, Values, Result\>(`factory`, ...`tokens`): (`container`: [Container](README.md#container)) => `Result`
471
+ ▸ **injectable**<`Tokens`, `Values`, `Result`\>(`factory`, ...`tokens`): (`container`: [`Container`](README.md#container)) => `Result`
470
472
 
471
473
  Decorates a factory by passing resolved tokens as factory arguments.
472
474
 
@@ -474,8 +476,8 @@ Decorates a factory by passing resolved tokens as factory arguments.
474
476
 
475
477
  | Name | Type |
476
478
  | :------ | :------ |
477
- | `Tokens` | `Tokens`: [Token](README.md#token)<unknown\>[] |
478
- | `Values` | `Values`: { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never} |
479
+ | `Tokens` | extends [`Token`](README.md#token)<`unknown`\>[] |
480
+ | `Values` | extends { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never } |
479
481
  | `Result` | `Result` |
480
482
 
481
483
  #### Parameters
@@ -493,25 +495,29 @@ Decorated factory which takes a dependency container as a single argument.
493
495
 
494
496
  ▸ (`container`): `Result`
495
497
 
498
+ Decorates a factory by passing resolved tokens as factory arguments.
499
+
496
500
  ##### Parameters
497
501
 
498
502
  | Name | Type |
499
503
  | :------ | :------ |
500
- | `container` | [Container](README.md#container) |
504
+ | `container` | [`Container`](README.md#container) |
501
505
 
502
506
  ##### Returns
503
507
 
504
508
  `Result`
505
509
 
510
+ Decorated factory which takes a dependency container as a single argument.
511
+
506
512
  #### Defined in
507
513
 
508
- [packages/ditox/src/utils.ts:56](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L56)
514
+ [packages/ditox/src/utils.ts:56](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L56)
509
515
 
510
516
  ___
511
517
 
512
518
  ### injectableProps
513
519
 
514
- ▸ **injectableProps**<Props, Result\>(`factory`, `tokens`): (`container`: [Container](README.md#container)) => `Result`
520
+ ▸ **injectableProps**<`Props`, `Result`\>(`factory`, `tokens`): (`container`: [`Container`](README.md#container)) => `Result`
515
521
 
516
522
  Decorates a factory by passing a resolved object with tokens as the first argument.
517
523
 
@@ -526,7 +532,7 @@ const result = decoratedFactory(container);
526
532
 
527
533
  | Name | Type |
528
534
  | :------ | :------ |
529
- | `Props` | `Props`: `ValuesProps` |
535
+ | `Props` | extends `ValuesProps` |
530
536
  | `Result` | `Result` |
531
537
 
532
538
  #### Parameters
@@ -534,7 +540,7 @@ const result = decoratedFactory(container);
534
540
  | Name | Type | Description |
535
541
  | :------ | :------ | :------ |
536
542
  | `factory` | (`props`: `Props`) => `Result` | A factory. |
537
- | `tokens` | `TokenProps`<Props\> | Object with tokens. |
543
+ | `tokens` | `TokenProps`<`Props`\> | Object with tokens. |
538
544
 
539
545
  #### Returns
540
546
 
@@ -544,25 +550,36 @@ Decorated factory which takes a dependency container as a single argument.
544
550
 
545
551
  ▸ (`container`): `Result`
546
552
 
553
+ Decorates a factory by passing a resolved object with tokens as the first argument.
554
+
555
+ **`example`**
556
+ ```ts
557
+ const factory = ({a, b}: {a: number, b: number}) => a + b;
558
+ const decoratedFactory = injectableProps(factory, {a: tokenA, b: tokenB});
559
+ const result = decoratedFactory(container);
560
+ ```
561
+
547
562
  ##### Parameters
548
563
 
549
564
  | Name | Type |
550
565
  | :------ | :------ |
551
- | `container` | [Container](README.md#container) |
566
+ | `container` | [`Container`](README.md#container) |
552
567
 
553
568
  ##### Returns
554
569
 
555
570
  `Result`
556
571
 
572
+ Decorated factory which takes a dependency container as a single argument.
573
+
557
574
  #### Defined in
558
575
 
559
- [packages/ditox/src/utils.ts:124](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L124)
576
+ [packages/ditox/src/utils.ts:124](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L124)
560
577
 
561
578
  ___
562
579
 
563
580
  ### optional
564
581
 
565
- ▸ **optional**<T\>(`token`, `optionalValue`): `OptionalToken`<T\>
582
+ ▸ **optional**<`T`\>(`token`, `optionalValue`): `OptionalToken`<`T`\>
566
583
 
567
584
  Decorate a token with an optional value.
568
585
  This value is be used as default value in case a container does not have registered token.
@@ -577,18 +594,18 @@ This value is be used as default value in case a container does not have registe
577
594
 
578
595
  | Name | Type | Description |
579
596
  | :------ | :------ | :------ |
580
- | `token` | [Token](README.md#token)<T\> | Existed token. |
597
+ | `token` | [`Token`](README.md#token)<`T`\> | Existed token. |
581
598
  | `optionalValue` | `T` | Default value for the resolver. |
582
599
 
583
600
  #### Returns
584
601
 
585
- `OptionalToken`<T\>
602
+ `OptionalToken`<`T`\>
586
603
 
587
604
  #### Defined in
588
605
 
589
- [packages/ditox/src/ditox.ts:41](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L41)
606
+ [packages/ditox/src/ditox.ts:41](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L41)
590
607
 
591
- ▸ **optional**<T\>(`token`): `OptionalToken`<T \| undefined\>
608
+ ▸ **optional**<`T`\>(`token`): `OptionalToken`<`T` \| `undefined`\>
592
609
 
593
610
  #### Type parameters
594
611
 
@@ -600,21 +617,21 @@ This value is be used as default value in case a container does not have registe
600
617
 
601
618
  | Name | Type |
602
619
  | :------ | :------ |
603
- | `token` | [Token](README.md#token)<T\> |
620
+ | `token` | [`Token`](README.md#token)<`T`\> |
604
621
 
605
622
  #### Returns
606
623
 
607
- `OptionalToken`<T \| undefined\>
624
+ `OptionalToken`<`T` \| `undefined`\>
608
625
 
609
626
  #### Defined in
610
627
 
611
- [packages/ditox/src/ditox.ts:45](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L45)
628
+ [packages/ditox/src/ditox.ts:45](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L45)
612
629
 
613
630
  ___
614
631
 
615
632
  ### resolveProps
616
633
 
617
- ▸ **resolveProps**<Props\>(`container`, `tokens`): `Props`
634
+ ▸ **resolveProps**<`Props`\>(`container`, `tokens`): `Props`
618
635
 
619
636
  Returns an object with resolved properties which are specified by token properties.
620
637
  If a token is not found, then `ResolverError` is thrown.
@@ -629,14 +646,14 @@ console.log(props); // {a: 1, b: 2}
629
646
 
630
647
  | Name | Type |
631
648
  | :------ | :------ |
632
- | `Props` | `Props`: `ValuesProps` |
649
+ | `Props` | extends `ValuesProps` |
633
650
 
634
651
  #### Parameters
635
652
 
636
653
  | Name | Type |
637
654
  | :------ | :------ |
638
- | `container` | [Container](README.md#container) |
639
- | `tokens` | `TokenProps`<Props\> |
655
+ | `container` | [`Container`](README.md#container) |
656
+ | `tokens` | `TokenProps`<`Props`\> |
640
657
 
641
658
  #### Returns
642
659
 
@@ -644,13 +661,13 @@ console.log(props); // {a: 1, b: 2}
644
661
 
645
662
  #### Defined in
646
663
 
647
- [packages/ditox/src/utils.ts:102](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L102)
664
+ [packages/ditox/src/utils.ts:102](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L102)
648
665
 
649
666
  ___
650
667
 
651
668
  ### resolveValues
652
669
 
653
- ▸ **resolveValues**<Tokens, Values\>(`container`, ...`tokens`): `Values`
670
+ ▸ **resolveValues**<`Tokens`, `Values`\>(`container`, ...`tokens`): `Values`
654
671
 
655
672
  Returns an array of resolved values by the specified token.
656
673
  If a token is not found, then `ResolverError` is thrown.
@@ -659,14 +676,14 @@ If a token is not found, then `ResolverError` is thrown.
659
676
 
660
677
  | Name | Type |
661
678
  | :------ | :------ |
662
- | `Tokens` | `Tokens`: [Token](README.md#token)<unknown\>[] |
663
- | `Values` | `Values`: { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never} |
679
+ | `Tokens` | extends [`Token`](README.md#token)<`unknown`\>[] |
680
+ | `Values` | extends { [K in string \| number \| symbol]: Tokens[K] extends Token<V\> ? V : never } |
664
681
 
665
682
  #### Parameters
666
683
 
667
684
  | Name | Type |
668
685
  | :------ | :------ |
669
- | `container` | [Container](README.md#container) |
686
+ | `container` | [`Container`](README.md#container) |
670
687
  | `...tokens` | `Tokens` |
671
688
 
672
689
  #### Returns
@@ -675,13 +692,13 @@ If a token is not found, then `ResolverError` is thrown.
675
692
 
676
693
  #### Defined in
677
694
 
678
- [packages/ditox/src/utils.ts:41](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/utils.ts#L41)
695
+ [packages/ditox/src/utils.ts:41](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/utils.ts#L41)
679
696
 
680
697
  ___
681
698
 
682
699
  ### token
683
700
 
684
- ▸ **token**<T\>(`description?`): [Token](README.md#token)<T\>
701
+ ▸ **token**<`T`\>(`description?`): [`Token`](README.md#token)<`T`\>
685
702
 
686
703
  Creates a new binding token.
687
704
 
@@ -699,8 +716,8 @@ Creates a new binding token.
699
716
 
700
717
  #### Returns
701
718
 
702
- [Token](README.md#token)<T\>
719
+ [`Token`](README.md#token)<`T`\>
703
720
 
704
721
  #### Defined in
705
722
 
706
- [packages/ditox/src/ditox.ts:31](https://github.com/mnasyrov/ditox/blob/990ffe7/packages/ditox/src/ditox.ts#L31)
723
+ [packages/ditox/src/ditox.ts:31](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L31)