UNPKG

shartjs

Version:

When your app crashes, it farts. That's it.

66 lines (43 loc) β€’ 1.38 kB
# πŸ› Debugging doesn't have to stink. But it can. [![npm](https://img.shields.io/npm/v/shartjs?color=%23ff69b4&label=npm)](https://www.npmjs.com/package/shartjs) [![License: MIT](https://img.shields.io/badge/license-MIT-green)](./LICENSE) [![Node](https://img.shields.io/badge/node-%3E%3D16-blue)](https://nodejs.org/) > **`shartjs`** is a tiny Node.js package that plays a random fart sound when your app crashes β€” consider it a strong motivator to write better error handling. --- ## πŸš€ Install ```bash pnpm add -D shartjs # or npm install --save-dev shartjs # or yarn add -D shartjs ``` ## πŸ›  Usage In your app entry point (index.ts, server.ts, etc.): ```ts import { initShart } from "shartjs"; initShart(); ``` Now, if your app throws an unhandled exception or rejection, shart will: β€’ πŸ’¨ Play a random fart sound β€’ πŸ’₯ Log the error β€’ ☠️ Exit the process ## 🌱 Dev-Only Mode Want to keep things professional in production? if (process.env.NODE_ENV === "development") { initShart(); } ## πŸ§ͺ Example ```ts import { initShart } from "shart"; initShart(); throw new Error("Oh no I sharted"); // πŸ’©πŸ’¨ ``` ## πŸ“¦ What’s Included - βœ… 3 glorious .wav fart files - βœ… Zero runtime dependencies (except play-sound) - βœ… Works with Node.js v16+ - βœ… ESM-only support (modern import style) ## πŸ“ License MIT Β© Parth Koshti