# @nerdbond/kink

Latest version **0.1.1** (published 2023-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nerdbond/kink
pnpm add @nerdbond/kink
yarn add @nerdbond/kink
bun add @nerdbond/kink
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-09-29 |
| First published | 2023-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lancejpollard |

## Links

- npm: https://www.npmjs.com/package/@nerdbond/kink
- npm.io page: https://npm.io/package/@nerdbond/kink

## Dependencies (1)

- [ts-custom-error](https://npm.io/package/ts-custom-error.md) ^3.3.1

## Recent versions

- 0.1.1 (latest) — 2023-09-29
- 0.1.0 — 2023-09-28
- 0.0.3 — 2023-08-30

## README

<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

<h3 align='center'>@nerdbond/kink</h3>
<p align='center'>
  Standard Error Creation in TypeScript
</p>

<br/>
<br/>
<br/>

## Installation

```
pnpm add @nerdbond/kink
yarn add @nerdbond/kink
npm i @nerdbond/kink
```

## Example

```ts
import Kink from '@nerdbond/kink'

const host = '@nerdbond/kink'

type Base = {
  syntax_error: {}
}

type Name = keyof Base

Kink.base(host, 'syntax_error', () => ({
  code: 1,
  note: 'Syntax error',
}))

Kink.code(host, (code: number) => code.toString(16).padStart(4, '0'))

export default function kink<N extends Name>(form: N, link?: Base[N]) {
  return new Kink(Kink.makeBase(host, form, link))
}
```

```ts
import kink from './example.js'

try {
  throw kink('syntax_error')
} catch (e) {
  console.log(e)
}
```

## License

MIT

## NerdBond

This is being developed by the folks at [NerdBond](https://nerd.bond), a
California-based project for helping humanity master information and
computation. Find us on [Twitter](https://twitter.com/nerdbond),
[LinkedIn](https://www.linkedin.com/company/nerdbond), and
[Facebook](https://www.facebook.com/nerdbond). Check out our other
[GitHub projects](https://github.com/nerdbond) as well!

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