From 3a067e080b271805bad8580150183bf1d9451590 Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Tue, 1 Jul 2014 23:09:10 +0100 Subject: [PATCH] Changes resolvers to be a static dependency --- src/Container.js | 4 ++-- src/resolvers.js | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Container.js b/src/Container.js index ae50cff..705b5e8 100644 --- a/src/Container.js +++ b/src/Container.js @@ -4,7 +4,7 @@ import generateType from './generateType' import invariant from './invariant' import {ACQUIRE, RELEASE, DISPOSE} from './signals' import { PROVIDER } from './options' -import createResolvers from './resolvers' +import resolvers from './resolvers' import VALUE from './options' import log from './log' @@ -18,7 +18,7 @@ var CONTAINER_ALIAS = '$container' class Container { constructor(conf, mappings) { - this._resolvers = createResolvers() + this._resolvers = resolvers this._mappings = mappings || {} this._resolving = {} this._pending = [] diff --git a/src/resolvers.js b/src/resolvers.js index dc1236c..82ef84c 100644 --- a/src/resolvers.js +++ b/src/resolvers.js @@ -19,16 +19,13 @@ import { CONSTRUCTOR, SINGLETON } from './options' - -export default function createResolvers() { - var resolvers = {} +var resolvers = {} - resolvers[ generateType([VALUE]) ] = compose(leftCurryTwice, resolveDeps)(identity) - resolvers[ generateType([CONSTRUCTOR]) ] = compose(leftCurryTwice, resolveDeps)(instanciate) - resolvers[ generateType([CONSTRUCTOR, SINGLETON]) ] = singletonify(instanciate) - resolvers[ generateType([PROVIDER]) ] = compose(leftCurryTwice, resolveDeps)(invoke) - resolvers[ generateType([SINGLETON, PROVIDER]) ] = singletonify(invoke) +resolvers[ generateType([VALUE]) ] = compose(leftCurryTwice, resolveDeps)(identity) +resolvers[ generateType([CONSTRUCTOR]) ] = compose(leftCurryTwice, resolveDeps)(instanciate) +resolvers[ generateType([CONSTRUCTOR, SINGLETON]) ] = singletonify(instanciate) +resolvers[ generateType([PROVIDER]) ] = compose(leftCurryTwice, resolveDeps)(invoke) +resolvers[ generateType([SINGLETON, PROVIDER]) ] = singletonify(invoke) - return resolvers -} \ No newline at end of file +export default resolvers \ No newline at end of file