Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "fount", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A source from which dependencies flow", | ||
@@ -26,2 +26,3 @@ "main": "./src/index.js", | ||
"dependencies": { | ||
"debug": "^1.0.4", | ||
"lodash": "^2.4.1", | ||
@@ -28,0 +29,0 @@ "when": "^3.3.1" |
@@ -27,3 +27,3 @@ var should = require( 'should' ); | ||
var result; | ||
fount.register( 'simpleFn', function() { return 'hello, world!' } ); | ||
fount.register( 'simpleFn', function() { return 'hello, world!'; } ); | ||
@@ -36,3 +36,3 @@ before( function( done ) { | ||
} ); | ||
} ) | ||
} ); | ||
@@ -44,2 +44,19 @@ it( 'should resolve the function\'s result', function() { | ||
describe( 'with dependency on a list', function() { | ||
var result; | ||
fount.register( 'simpleList', [ 1, 2, 3 ] ); | ||
before( function( done ) { | ||
fount.resolve( 'simpleList' ) | ||
.then( function( list ) { | ||
result = list; | ||
done(); | ||
} ); | ||
} ); | ||
it( 'should resolve to the list', function() { | ||
result.should.eql( [ 1, 2, 3 ] ); | ||
} ); | ||
} ); | ||
var a = { one: 1 }; | ||
@@ -339,3 +356,3 @@ | ||
} ); | ||
} ) | ||
} ); | ||
@@ -342,0 +359,0 @@ describe( 'when using custom containers', function() { |
@@ -5,2 +5,3 @@ var _ = require( 'lodash' ); | ||
var whenKeys = require( 'when/keys' ); | ||
var debug = require( 'debug' )( 'fount' ); | ||
@@ -47,3 +48,3 @@ var containers = {}; | ||
function purgeAll() { | ||
containers = { scopes: {} } | ||
containers = { scopes: {} }; | ||
} | ||
@@ -68,6 +69,9 @@ | ||
} | ||
if( _.isFunction( fn ) ) { | ||
dependencies = checkDependencies( fn, dependencies ); | ||
} else { | ||
fn = fn || dependencies; | ||
} | ||
debug( 'Registering key "%s" for container "%s" with %s lifecycle: %s', key, containerName, lifecycle, dependencies, fn ); | ||
var promise = wrappers[ lifecycle ]( containerName, key, fn, dependencies ); | ||
@@ -129,3 +133,3 @@ container( containerName )[ key ] = promise; | ||
} | ||
} | ||
}; | ||
}, | ||
@@ -138,3 +142,3 @@ scoped: function ( containerName, key, value, dependencies ) { | ||
return resolvedTo; | ||
} | ||
}; | ||
if( cache[ key ] ) { | ||
@@ -158,3 +162,3 @@ return cache[ key ]; | ||
} | ||
} | ||
}; | ||
}, | ||
@@ -191,4 +195,4 @@ static: function( containerName, key, value, dependencies ) { | ||
fount.purgeScope = purgeScope.bind( undefined, 'default' ); | ||
fount.log = function() { console.log( containers ) }; | ||
fount.log = function() { console.log( containers ); }; | ||
module.exports = fount; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23557
514
3
+ Addeddebug@^1.0.4
+ Addeddebug@1.0.5(transitive)
+ Addedms@2.0.0(transitive)