# result-state

> This is a wrapper for managing error, result and loading state with rxjs

Latest version **1.0.2** (published 2023-03-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install result-state
pnpm add result-state
yarn add result-state
bun add result-state
```

## 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.2 |
| Published | 2023-03-28 |
| First published | 2023-03-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | frankydevmenta |

## Links

- npm: https://www.npmjs.com/package/result-state
- Repository: https://github.com/frankleonardopumachara/result-state
- Homepage: https://github.com/frankleonardopumachara/result-state#readme
- Issues: https://github.com/frankleonardopumachara/result-state/issues
- npm.io page: https://npm.io/package/result-state

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^7.8.0

## Recent versions

- 1.0.2 (latest) — 2023-03-28
- 1.0.1 — 2023-03-28
- 1.0.0 — 2023-03-28

## README

# result-state
This is a wrapper for managing error, result and loading state with rxjs

# Usage
```
const resultState = new ResultState<string>()

resultState.loadingState()
resultState.errorState('an error occurred')
resultState.successState('successful operation')


resultState.state$.subscribe(state => {
  if (state.loading) {
    // show charging indicator
  } else if (state.error) {
    // show error message
  } else if (state.result) {
    // show result
  }
})
```

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