# difunc

> Dependency Injection for JavaScript functions

Latest version **0.0.4** (published 2018-05-01) · MIT license · 0 weekly downloads

## Install

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

## 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.0.4 |
| Published | 2018-05-01 |
| First published | 2018-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 59.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joseph Spencer |
| Maintainers | jsdevel |
| Keywords | dependency, injection, di |

## Links

- npm: https://www.npmjs.com/package/difunc
- Repository: https://github.com/kogosoftwarellc/js-difunc
- Homepage: https://github.com/kogosoftwarellc/js-difunc#readme
- Issues: https://github.com/kogosoftwarellc/js-difunc/issues
- npm.io page: https://npm.io/package/difunc

## Dependencies (1)

- [esprima](https://npm.io/package/esprima.md) ^4.0.0

## 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.0.4 (latest) — 2018-05-01
- 0.0.3 — 2018-05-01
- 0.0.2 — 2018-04-28
- 0.0.1 — 2018-04-28

## README

# js-difunc [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]
> Dependency Injection for JavaScript functions.

`difunc(dependencies, func[, thisArg])`

Calls `func` with the dependencies defined in `dependencies`.  The parameter names
of `func` are the keys of `dependencies` used in the resolution.

## Installing

```
npm i difunc
```

## Example Usage

```js
import difunc from 'difunc';

const dependencies = {
  man: {
    age: 36,
    firstName: 'Clint',
    lastName: 'Eastwood'
  },
  year: 1964
};

console.log(difunc(dependencies, year => year)); // 1964

```


## LICENSE
``````
The MIT License (MIT)

Copyright (c) 2018 Kogo Software LLC

Permission is hereby granted, free of charge, to any person obtaining a   copy
of this software and associated documentation files (the "Software"), to  deal
in the Software without restriction, including without limitation the     rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
``````

[downloads-image]: http://img.shields.io/npm/dm/difunc.svg
[npm-url]: https://npmjs.org/package/difunc
[npm-image]: http://img.shields.io/npm/v/difunc.svg

[travis-url]: https://travis-ci.org/kogosoftwarellc/js-difunc
[travis-image]: http://img.shields.io/travis/kogosoftwarellc/js-difunc.svg

[coveralls-url]: https://coveralls.io/r/kogosoftwarellc/js-difunc
[coveralls-image]: http://img.shields.io/coveralls/kogosoftwarellc/js-difunc/master.svg

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