From 3b333d1327cc2e0d7feca93ab1a694292e763bc9 Mon Sep 17 00:00:00 2001 From: Mikalai Silivonik Date: Wed, 27 Nov 2024 22:28:43 -0500 Subject: [PATCH] fixed fromObject --- src/Container.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Container.ts b/src/Container.ts index 42f15f2..071c63e 100644 --- a/src/Container.ts +++ b/src/Container.ts @@ -1,17 +1,8 @@ import type { Memoized } from "./memoize"; import { isMemoized, memoize } from "./memoize"; import { PartialContainer } from "./PartialContainer"; -import type { - AddService, - AddServices, - MapTokensToTypes, - InjectableFunction, - TokenType, - ValidTokens, - ServicesFromTokenizedParams, -} from "./types"; +import type { AddService, AddServices, MapTokensToTypes, InjectableFunction, TokenType, ValidTokens } from "./types"; import { ConcatInjectable, Injectable } from "./Injectable"; -import { entries } from "./entries"; type MaybeMemoizedFactories = { [K in keyof Services]: (() => Services[K]) | Memoized<() => Services[K]>; @@ -150,8 +141,8 @@ export class Container { * defines the initial set of services to be contained within the new Container instance. * @returns A new Container instance populated with the provided services. */ - static fromObject(services: Services): Container { - return entries(services).reduce( + static fromObject(services: Services): Container { + return Object.entries(services).reduce( (container, [token, value]) => container.providesValue(token, value), new Container({}) ) as Container;