# @termsurf/kink

Latest version **0.2.3** (published 2024-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @termsurf/kink
pnpm add @termsurf/kink
yarn add @termsurf/kink
bun add @termsurf/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.2.3 |
| Published | 2024-05-27 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lancejpollard |

## Links

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

## Dependencies (1)

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

## Recent versions

- 0.2.3 (latest) — 2024-05-27
- 0.2.2 — 2024-05-27
- 0.2.1 — 2024-05-27
- 0.2.0 — 2024-05-27
- 0.1.6 — 2024-02-20
- 0.1.4 — 2024-02-20
- 0.1.2 — 2023-12-14
- 0.1.1 — 2023-12-14

## README

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

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

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

## Installation

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

## Example

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

const host = '@termsurf/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

## TermSurf

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

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