0.0.2 • Published 10 months ago
@tunebond/kink v0.0.2
Installation
pnpm add @tunebond/kink
yarn add @tunebond/kink
npm i @tunebond/kink
Example
import Kink from '@tunebond/kink'
const host = '@tunebond/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))
}
import kink from './example.js'
try {
throw kink('syntax_error')
} catch (e) {
console.log(e)
}
License
MIT
TuneBond
This is being developed by the folks at TuneBond, a California-based project for helping humanity master information and computation. Find us onTwitter, LinkedIn, and Facebook. Check out our other GitHub projects as well!