# lightject

> Lightweight module for Dependency Injection

Latest version **0.2.5** (published 2017-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install lightject
pnpm add lightject
yarn add lightject
bun add lightject
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2017-05-30 |
| First published | 2015-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Daeren Torn |
| Maintainers | daeren |
| Keywords | di, injection, dependency injection, fundamental, justdoit, injectality |

## Links

- npm: https://www.npmjs.com/package/lightject
- Repository: https://github.com/Daeren/Lightject
- Homepage: http://666.io
- Issues: https://github.com/Daeren/Lightject/issues
- npm.io page: https://npm.io/package/lightject

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.2.5 (latest) — 2017-05-30
- 0.2.4 — 2017-05-19
- 0.2.3 — 2016-05-24
- 0.2.2 — 2016-04-05
- 0.2.1 — 2016-04-05
- 0.2.0 — 2016-04-05
- 0.1.0 — 2016-04-05
- 0.0.13 — 2016-04-04
- 0.0.12 — 2016-04-04
- 0.0.11 — 2015-11-30
- 0.0.10 — 2015-11-27
- 0.0.9 — 2015-11-27
- 0.0.8 — 2015-11-09
- 0.0.7 — 2015-08-30
- 0.0.6 — 2015-08-27
- … 5 more at https://npm.io/package/lightject/versions

## README

[![Codacy][cod_b]][cod_l] ![NodeSecurity][node_sec_b]

`npm install lightject`


```js
require("lightject")

let ctx = {
        "payload": "!"
    };

let binds = {
        "myBind": "?"
    };

let data = {
        "myBind": "Replace!",

        "input":  "Simple start",
        "output": console.log
    };

let print;

//-------------]>

$injector
    .value("x", 0)
    .service("y", function(x) { this.v = 1 + x; })
    .factory("z", function(x, y) { return {"v": 3 + x + y.v}; });
    
print = $injector(fLog, binds);
print(data, ctx);

$injector.run(fLog, data, ctx);
$injector.run(["x", "y", function(d1, d2) { return d1 + d2.v; }]);

//-------------]>

function fLog(input, output, myBind) {
    output(input + this.payload + myBind);
}
```

* Coverage: +
* Benchmark: +
* Browser: +
* valueOf/toString: +


#### Module

| Method          | Arguments                   | Return                           |
|-----------------|-----------------------------|----------------------------------|
|                 | -                           |                                  |
| createInstance  |                             | this                             |
|                 | -                           |                                  |
| onCaller        | callback(name, data, ctx)   | this or exception                |
|                 | -                           |                                  |
| value           | name, value                 | this                             |
| service         | name, func                  | this                             |
| factory         | name, func                  | this                             |
|                 | -                           |                                  |
| table           | table[, binds]              | table or null                    |
|                 | -                           |                                  |
| run             | f, data[, ctx]              | result of a function or null     |
| runTable        | table, data[, ctx]          | table or null                    |
| execTable       | table, data[, ctx]          | overwritten table or null        |


#### System variables

| Name      | Desc                                |
|-----------|-------------------------------------|
| $in       |                                     | 


## License

MIT

----------------------------------
[@ Daeren Torn][1]


[1]: http://666.io

[cod_b]: https://img.shields.io/codacy/5ce7382c312d4cd091acabd06bfcde15.svg
[cod_l]: https://www.codacy.com/app/daeren/Lightject/dashboard

[node_sec_b]: https://nodesecurity.io/orgs/xiii/projects/39b19817-5525-4498-93e5-a2887f20e901/badge

---
_Source: https://npm.io/package/lightject · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
