# node-result

> result

Latest version **13.0.0** (published 2023-03-07) · MIT license · 0 weekly downloads

## Install

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

## 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 | 13.0.0 |
| Published | 2023-03-07 |
| First published | 2020-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Grigoriy Baranov |
| Maintainers | watchdg |
| Keywords | result |

## Links

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

## Recent versions

- 13.0.0 (latest) — 2023-03-07
- 12.1.0 — 2022-04-25
- 12.0.3 — 2021-12-03
- 12.0.2 — 2021-05-29
- 12.0.1 — 2021-05-17
- 12.0.0 — 2021-04-08
- 11.0.0 — 2021-04-06
- 10.1.0 — 2021-03-13
- 10.0.0 — 2021-02-27
- 9.2.0 — 2021-02-12
- 9.1.0 — 2021-02-12
- 9.0.0 — 2021-02-12
- 8.1.0 — 2021-02-11
- 8.0.0 — 2021-01-16
- 7.0.0 — 2021-01-16
- … 20 more at https://npm.io/package/node-result/versions

## README

# node-result

## install

```shell
npm install node-result
# or
yarn add node-result
```

## example

```ts
import { ok, fail } from "node-result";

async function checker(data: any) {
  try {
    if (typeof data !== 'string') {
      return fail(void 0);
    }
    return ok(null);
  } catch (error) {
    return fail(error);
  }
}

(async () => {
  (await checker('foo'));           // return Result
  (await checker(5));               // return Result
  (await checker('bar'));           // return Result

  (await checker('foo')).unwrap();  // return null
  (await checker(5)).unwrap();      // throw undefined
  (await checker('bar')).unwrap();  // not done
})();
```

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