yeet-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Yeet

One day, JavaScript will have throw expressions. Until then, yeet!

function save(filename = yeet("Argument required")) { ... }

const encoder = encoding === "utf8" ? new UTF8Encoder() 
              : encoding === "utf16le" ? new UTF16Encoder(false) 
              : encoding === "utf16be" ? new UTF16Encoder(true) 
              : yeet(TypeError, "Unsupported encoding");

class Product {
  get id() { return this._id; }
  set id(value) { this._id = value ?? yeet("Invalid value"); }
}

Install

NPM

npm install yeet-ts
# or
pnpm install yeet-ts
# or
bun install yeet-ts

... and then

import { yeet } from "yeet-ts";

Deno

import { yeet } from "https://deno.land/x/yeet@v1.0.3/src/mod.ts";

Contribute

To install dependencies:

bun install

To build:

bun run build

To publish:

bun run pub

Readme

Keywords

none

Package Sidebar

Install

npm i yeet-ts

Weekly Downloads

47

Version

1.0.3

License

CC0-1.0

Unpacked Size

9.26 kB

Total Files

5

Last publish

Collaborators

  • c.sha