Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including lujs with all npm packages installed. Try it out:

var lujs = require("lujs")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

lujs v0.1.3

minimalstic di library


Lightweight dependency injection lib written in JavaScript.


var container = lu()

    // services are singletons
    .service('myService', function() {
        return {
            getFoo: function() {
                return 'foo';

    // this is how dependencies get passed in
    .service('myOtherService', ['myService'], function(myService) {
        return myService.getFoo() + ' bar';

    // you can also define values as dependencies
    .value('myVal', ' is a random value')

    // factories get always called when they
    // get injected.
    .factory('myFactory', ['myVal'], function(myVal) {
        return Math.random() + myVal;

// get a registered dependency
var myService = container.get('myService');

// run some anonymous function and pass
// dependencies in
container(['myFactory', 'myVal'], function(myFactory, myVal) {



npm install lujs


bower install lu


Copyright (c) 2014 Simon Kusterer Licensed under the MIT license.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free