# @cfstcyr/ts-saved-config

> Save config to a file or in the browser local storage. This package uses `configstore` for its file storage and `store2` for its browser local storage.

Latest version **1.0.1** (published 2023-04-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install @cfstcyr/ts-saved-config
pnpm add @cfstcyr/ts-saved-config
yarn add @cfstcyr/ts-saved-config
bun add @cfstcyr/ts-saved-config
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-10 |
| First published | 2023-04-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 68.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | cfstcyr |

## Links

- npm: https://www.npmjs.com/package/@cfstcyr/ts-saved-config
- npm.io page: https://npm.io/package/@cfstcyr/ts-saved-config

## Dependencies (2)

- [store2](https://npm.io/package/store2.md) ^2.14.2
- [configstore](https://npm.io/package/configstore.md) ^5.0.1

## Recent versions

- 1.0.1 (latest) — 2023-04-10
- 1.0.0 — 2023-04-10

## README

# ts-saved-config

Save config to a file or in the browser local storage. This package uses `configstore` for its file storage and `store2` for its browser local storage.

## Usage

```ts
import { Configuration, num, str } from '@cfstcyr/ts-saved-config';

const myConfig = Configuration('file', 'my-config', {
    apiKey: str({
        required: true,
    }),
    user: json<User>({}),
    count: num({
        default: 10,
    }),
});

myConfig.getApiKey(); // Returns string or throws an error if not set
myConfig.get('user'); // Returns User or undefined if not set
myConfig.get('count'); // Returns number or 10 if not set
```

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