# automated-omusubi

> Improved [omusubi](https://www.npmjs.com/package/omusubi). You do not need to register.

Latest version **0.0.9** (published 2024-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install automated-omusubi
pnpm add automated-omusubi
yarn add automated-omusubi
bun add automated-omusubi
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2024-04-22 |
| First published | 2020-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | kojiro.ueda |

## Links

- npm: https://www.npmjs.com/package/automated-omusubi
- npm.io page: https://npm.io/package/automated-omusubi

## Dependencies (1)

- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Recent versions

- 0.0.9 (latest) — 2024-04-22
- 0.0.8 — 2021-04-01
- 0.0.7 — 2021-03-31
- 0.0.6 — 2020-12-28
- 0.0.5 — 2020-11-30
- 0.0.4 — 2020-05-07
- 0.0.3 — 2020-05-06
- 0.0.2 — 2020-05-06
- 0.0.1 — 2020-05-06

## README

# automated-omusubi

Improved [omusubi](https://www.npmjs.com/package/omusubi).
You do not need to register.

# how to use

**important**

You must enable TypeScript compiler options.

```javascript
{
  "compilerOptions": {
    // ...
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
    // ...
  }
}
```

## automated injection

```typescript
import {named, binding} from "automated-omusubi";

@named
class Injectable {
  x = "foo";
}

class Injected {
  @binding
  foo!: Injectable;

  func() {
    return this.foo; // <-- Injectable instance.
  }
}

console.log(new Injected().func());
```

## identifier specified injection

It can be used in `dependency inversion principle`

```typescript
import {namedWith, bindBy} from "automated-omusubi";

abstract class AbstractInjectable {
  x = "bar";
}

@namedWith(AbstractInjectable)
class Injectable extends AbstractInjectable {
  y = "foo";
}

class Injected {
  @bindBy(AbstractInjectable)
  foo!: AbstractInjectable;

  func() {
    return this.foo; // <-- Injectable instance.
  }
}

console.log(new Injected().func());
```

## identifier specified injection and explicitly instance registration

```typescript
import {register, bind} from "automated-omusubi";

class Injectable {
  y = "foo";
  z: string;
  constructor(z: string) {
    this.z = z;
  }
}

class Injected {
  @bind
  foo!: Injectable;

  func() {
    return this.foo; // <-- Injectable instance.
  }
}

register(new Injectable("bar")).as(Injectable);
console.log(new Injected().func());
```

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