# anyioc

> [![Build Status](https://travis-ci.com/Cologler/anyioc-typescript.svg?branch=master)](https://travis-ci.com/Cologler/anyioc-typescript) [![npm](https://img.shields.io/npm/v/anyioc.svg)](https://www.npmjs.com/package/anyioc) [![](https://data.jsdelivr.com/

Latest version **0.3.2** (published 2020-07-20) · MIT license · 0 weekly downloads

## Install

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

## 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.3.2 |
| Published | 2020-07-20 |
| First published | 2018-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cologler |
| Maintainers | cologler |
| Keywords | ioc |

## Links

- npm: https://www.npmjs.com/package/anyioc
- Repository: https://github.com/Cologler/anyioc-typescript
- Issues: https://github.com/Cologler/anyioc-typescript/issues
- npm.io page: https://npm.io/package/anyioc

## Recent versions

- 0.3.2 (latest) — 2020-07-20
- 0.3.1 — 2020-07-20
- 0.3.0 — 2020-07-20
- 0.2.3 — 2018-09-28
- 0.2.2 — 2018-09-26
- 0.2.1 — 2018-09-26
- 0.2.0 — 2018-08-23
- 0.1.1 — 2018-08-21
- 0.1.0 — 2018-08-21

## README

# anyioc

[![Build Status](https://travis-ci.com/Cologler/anyioc-typescript.svg?branch=master)](https://travis-ci.com/Cologler/anyioc-typescript)
[![npm](https://img.shields.io/npm/v/anyioc.svg)](https://www.npmjs.com/package/anyioc)
[![](https://data.jsdelivr.com/v1/package/gh/Cologler/anyioc-typescript/badge)](https://www.jsdelivr.com/package/gh/Cologler/anyioc-typescript)

Another simple ioc framework for javascript/typescript.

## Install

### for Node

``` cmd
npm install anyioc
```

### for Browser

Use packed file `dist.browser/anyioc.js`.

## Usage

``` typescript
import { ServiceProvider } from "anyioc";
const provider = new ServiceProvider();
provider.registerSingleton('the key', ioc => 102); // ioc will be scoped ServiceProvider
value = provider.get('the key'); // 102
```

There are some predefined key you can use direct, but you still can overwrite it:

* `ioc` - get current scoped ServiceProvider instance.
* `provider` - alias of `ioc`

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