chucklejs
v1.0.0
Published
A wrapper for jokeapi.dev. Get random jokes with categorical sorting.
Readme
Installation
Use the install command of your favourite package manager!
e.g.
npm install chucklejsUsage
Simply import which ever utilities you would like to use
e.g.
import { getJoke } from "chucklejs";
try {
console.log(
await getJoke(["Programming", "Dark", "Pun"], {
blacklistFlags: ["nsfw", "racist", "explicit"],
types: ["twopart"],
})
/* [
{
category: "Programming",
type: "twopart",
setup: "why do python programmers wear glasses?",
delivery: "Because they can't C.", 🤣🤣🤣
}
]
*/
]
);
} catch (error) {
/* Error Handling */
}Docs
function getJoke(
categories: Category[] | undefined,
{ blacklistFlags, amount, language, contains, types }: Options
): Promise<
(
| {
category: Category;
type: "single";
joke: string;
}
| {
category: Category;
type: "twopart";
setup: string;
delivery: string;
}
)[]
>;