Super simple DI for JavaScript, targetted mainly at spec test setup

Usage no npm install needed!

<script type="module">
  import tel from '';



tel is designed to provide a similar feature to RSpec's let function in mocha. For more information on why this is useful, see this stackoverflow question "When to use RSpec let"

build status


tel can be used with Node.js and in modern browsers

Install via npm

npm install tel --save

Or simply copy tel.js into the desired location


var Tel = require('tel');
var tel = Tel();

// Set a value
tel('number', 5);
tel('url', '');
tel.also = 'as property';

// Set a lazy value
tel('later', function() {
    return [];

// Access values by property
5 === tel.number;

// Refer to other values
tel('added', function() {
    return tel.later.push(tel.number);

// Values can also be calculated asynchronously
tel('webpage', function(done) {
    request(tel.url, done);

// But make sure you access them asynchronously too
tel.webpage(function(err, response, body) {

Lazy and async values are only ever calculated once per tel() instance.

For more examples, see the unit tests