magical inversion of control for nodejs and the browser
magical inversion of control for Node.js and the browser
Hinoki seems to be the least surprising IoC container available for Node.
I definitely do like its ascetic worldview.
Thanks a lot for this!
var hinoki = require'hinoki';
hinoki is useful when your problem, application, problem or computation consists of multiple values that depend on each other.
a value can be anything: an integer, an object, a function, a class, ...
the value of a controller action might depend on
the value of a function to retrieve some data from a database which might depend on the value of a connection pool which might depend on
the value of an url to the database...
a name is - you guessed it - the name of a value.
let's use our knowledge to define the factories for that:
var factories =returnreturn xsreduce return acc + x; 0;return numbersmap return x * x; ;return numbersslicesort;return numberslength;return numbersSortedMathroundcount;return sumFnnumbers / count;return sumFnnumbersSquared / count;return meanOfSquares - mean * mean;;
lifetime.factoriescan be array of sources
function(name : string) -> factory or undefined
mapName(string) -> string