# @shepherdorg/nano-inject

> Minimalistic dependency injection library...

Latest version **5.1.0** (published 2021-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shepherdorg/nano-inject
pnpm add @shepherdorg/nano-inject
yarn add @shepherdorg/nano-inject
bun add @shepherdorg/nano-inject
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2021-03-03 |
| First published | 2019-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Guðlaugur S. Egilsson |
| Maintainers | stefaneg, nordfjord |
| Keywords | dependency injection, typescript |

## Links

- npm: https://www.npmjs.com/package/@shepherdorg/nano-inject
- Repository: https://github.com/ShepherdOrg/shepherd
- Homepage: https://github.com/ShepherdOrg/shepherd#readme
- Issues: https://github.com/ShepherdOrg/shepherd/issues
- npm.io page: https://npm.io/package/@shepherdorg/nano-inject

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 5.1.0 (latest) — 2021-03-03
- 0.0.7 (YT6ea26df0bcb78bb369f4a35e350044184883e215) — 2019-10-23
- 0.0.6 (YT6592234accc07a3c631e679417be15fc9a970179) — 2019-04-19
- 0.0.5 (YT62c5c6c2b081ad042be55d2ffd2fe3c975642850) — 2019-04-19
- 0.0.2-alpha.1 (canary) — 2019-02-15
- 5.0.0 — 2020-10-28
- 4.3.0 — 2020-04-13
- 4.0.0 — 2020-02-27
- 3.0.0 — 2020-01-14
- 2.2.0 — 2019-12-01
- 2.0.2 — 2019-11-23
- 2.0.1 — 2019-11-23
- 2.0.0 — 2019-11-20
- 0.0.4 — 2019-04-19
- 0.0.2-alpha.0 — 2019-02-15
- … 4 more at https://npm.io/package/@shepherdorg/nano-inject/versions

## README

### Nano dependency injection.

Minimalistic dependency injection library.

The tests are the best documentation in this case.

```typescript
import {expect} from 'chai'
   import {inject} from './inject'
   
   describe('inject dependency injection', function(){
   
       it('should return injected dependency',function(){
           var deps = inject({
               foo:"bar"
           });
           expect(deps("foo")).to.equal('bar');
       });
   
       it('should fail on missing dependency',function(){
           try{
               var deps = inject({
                   foo:"bar"
               });
               deps("baz");
           }  catch (e){
               expect(e.message).to.eql('Required dependency <baz> is not provided.');
           }
       });
   
       it('should not fail on optional missing dependency', function(){
           var deps = inject({
               x:"bar"
           });
           expect(deps("foo", true)).to.equal(undefined);
       })
   
   });
   
   
```

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