open-index/open-npm huggingface dataset:
npm package: @infini-dev/inject
Description: Micro and ultra light Dependency Injection Container
Author: Infinisoft Inc.
Latest version: 1.0.28
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

<!-- markdownlint-disable-next-line -->
<br />
Banner
160 bytes
0 dependencies

## Getting Started
Common design pattern to write loosely coupled code and being polite to others reading it.

> **Common use case**  
> Reusability, scalability Avoid code duplication

## Install
Run of one these command to install.  

```sh
$ npm i @infini-dev/inject
```  

or

```sh
$ yarn add @infini-dev/inject
``` 

# Examples
To add, remove and consume a dependency. 

### Add
```javascript
import { Container } from "@infini-dev/inject";

const inject = Container();
inject.add("dependency", (a)=>a*2)
```

### Initialize
```javascript
import { Container } from "@infini-dev/inject";

const inject = Container({
  test: (a)=>a*2
});
```

### Remove
```javascript
import { Container } from "@infini-dev/inject";

const inject = Container({
  test: (a)=>a*2
});

inject.remove("test")
```

### Consume
```javascript
import { Container } from "@infini-dev/inject";

const inject = Container({
  test: (a)=>a*2
});

const myTest = inject.getInstance("test")
console.log(myTest(2))
```

# Learn
Let's create program to show weather. Everywhere in that app is required
to have the weather.

We could write everywhere to fetch the weather directly.

What is going to happen if the weather url change? It's going to be required
to walk trhough code and replace to another url.
How are you going to test if url is different somewhere.

Using Dependency Injection, it's possible to replace the implementation without
having impact somewhere else. In this case, changing url.
```javascript
import { Container } from "@infini-dev/inject";
// Initialize
const inject = Container({
  getWeather: await fetchWeather("https://my.weather.api.com")
});


// Consumer where you need it
const weather = inject.getInstance("getWeather")
console.log(weather())
```


Powered 🚀 by [Infinisoft Inc.](https://www.infinisoft.world)
<br>
Wanna code the future? Come with us [https://www.infinisoft.dev]
npm package: @infini-dev/logger
Description: Micro logging
Author: Infinisoft Inc.
Latest version: 1.0.38
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.


## Getting Started
Micro logger with levels. Default output is console. Easy to integrate external sources.

> **Common use case**  
> Anything. For example, we use it to output data on external source like Sentry or Logrocket.

## Install
Run of one these command to install.  
```sh
npm i @infini-dev/logger
```  

or

```sh
yarn add @infini-dev/logger
```

## Examples
### Default
Output all level.

```typescript
import {logger} from '@infini-dev/logger'
const {error} = logger()

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}
```
### Debug Log Level
Output debug level.

```typescript
import {logger} from '@infini-dev/logger'
const {error} = logger({level: "debug"})

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}
```
### External Log
Sends logs to external.

```typescript
import {logger} from '@infini-dev/logger'

const externalLog = () => {
  //send logs to externalsystem
  }

const myAdapter: ILogger = {
  debug: externalLog,
  info:  externalLog,
  warn:  externalLog,
  error:  externalLog,
  log:  externalLog
};

const {error} = logger({logger: myAdapter})

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}
```

Powered 🚀 by [Infinisoft Inc.](https://www.infinisoft.world)
<!-- markdownlint-disable-next-line -->
<br>

Wanna code the future? Come with us [https://www.infinisoft.world]