# config-tiny

> A mimimal implementation of the popular config library. It can be used to saving environment variables.

Latest version **1.0.8** (published 2020-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install config-tiny
pnpm add config-tiny
yarn add config-tiny
bun add config-tiny
```

## 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 | 1.0.8 |
| Published | 2020-06-28 |
| First published | 2020-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Olohundare Nasirudeen |
| Maintainers | naskkotech |
| Keywords | conf, config, configuration, node-config, config-node, env, environment |

## Links

- npm: https://www.npmjs.com/package/config-tiny
- Repository: https://github.com/iamnasirudeen/config.tiny
- Homepage: https://github.com/iamnasirudeen/config.tiny#readme
- Issues: https://github.com/iamnasirudeen/config.tiny/issues
- npm.io page: https://npm.io/package/config-tiny

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.8 (latest) — 2020-06-28
- 1.0.5 — 2020-06-26
- 1.0.2 — 2020-06-25
- 1.0.0 — 2020-06-25

## README

# CONFIG TINY :blush:

A personal implemention of the popular config library on NPM

## Quick Start

```bash
npm i config-tiny
```

or

```bash
yarn add config-tiny
```

You can also fork the project on github at https://github.com/iamnasirudeen/config.tiny

## Usage

Create a **config** folder in the root directory of your project and create a file inside the folder named **default.json**.

e.g

```bash
cd `path/to/project/` && mkdir config && cd config && touch default.json
```

The code above helps you create a config folder and also a default.json file inside the folder then you can use it like this.

The content of the `default.json` file should look like the one below.

```js
{
  "data": {
    "email": "iamnasirudeen@gmail.com"
  },
  "github_handle": "iamnasirudeen",
  "port": 3000
}

```

Then

```js
const config = require("config-tiny");
let port = config.get("port") || process.env.PORT;
```

You can also check the validity of a string before getting the value using the `config.has` function. e.g

```js
const config = require("config-tiny");

// Note: config.has function returns a boolean of true/false

// using ternary operator
const port = config.has("port") ? config.get("port") : 3000;

// using if statement
if (config.has("data.email")) {
  // do anything with your value here
  let email = config.get("data.email");
}
```

## Note

The Config folder has to be in the root directory of your project as config uses the nodejs `process.cwd()` API to locate the root directory of the config folder.

`config.tiny` doesnt really support nested objects a future version would have this feature supported.

e.g

```js
config.get("data.email"); // iamnasirudeen@gmail.com
config.get("data"); // {email: "iamnasirudeen@gmail.com"}
config.get("github_handle"); // iamnasirudeen
```

## Use Case

config.tiny can be used to save environment keys. It can be used in replace of DotEnv.

Contributors are also allowed. You can hit me up at iamnasirudeen@gmail.com.

Developed with :heart: by Olohundare Nasirudeen <https://github.com/iamnasirudeen>

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