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

1.0.1 • Public • Published

sappQuestions

sappQuestions is a very lightweight npm package that provides a collection of questions with various categories. It allows you to retrieve random questions or questions from specific categories. All questions were manually curated, ensuring no duplicates, no API reliance, and no downtime.

Installation

You can install sappQuestions using npm:

npm install sappquestions@latest

Usage

Here's an example how to use sappQuestions:

/* JavaScript */ const { Language, getRandomQuestion, fetchCategories, fetchQuestions } = require("sappquestions")
/* TypeScrippt */ import { Language, getRandomQuestion, fetchCategories, fetchQuestions } from "sappquestions"

// Fetch and display a random quote
await getRandomQuestion().then((question) => {
    console.log(`"${question.question}" - ${question.category}`);
  });

// Fetch and display a random quote from a specific category
const category = "coding";
await getRandomQuestion(category).then((question) => {
  console.log(`"${question.question}" - ${question.category}`);
});

// Fetch and display available categories
await fetchCategories().then((categories) => {
  console.log("Available categories:", categories);
});

// Fetch and display available questions
await fetchQuestions(Language["en-US"]).then((questions) => {
  console.log("Available questions:", questions);
});

API

The sappQuestions package provides the following functions:

getRandomQuestion(category?: string, language: Language)

Retrieve a random question from a specific category.

  • category?: The category from which to retrieve the question.
  • language: The language from which to retrieve the question.

fetchCategories

Retrieve all available questions.

fetchQuestions(Language)

Retrieve all available questions.

  • language: The language from which to retrieve the question.

Languages

All available languages

  • Arabic, Egypt (العربية، مصر)
  • Bulgarian (български)
  • ChineseCN (简体中文)
  • ChineseTW (繁體中文)
  • Croatian (Hrvatski)
  • Czech (čeština)
  • Danish (Dansk)
  • Dutch (Nederlands)
  • English (United Kingdom)
  • English (United States)
  • Finnish (Suomi)
  • French (Français)
  • German (Deutsch)
  • Greek (Ελληνικά)
  • Hindi (हिन्दी)
  • Hungarian (Magyar)
  • Indonesian (Bahasa Indonesia)
  • Italian (Italiano)
  • Japanese (日本語)
  • Korean (한국어)
  • Lithuanian (Lietuvių)
  • Norwegian (Norsk)
  • Polish (Polski)
  • PortugueseBR (Português)
  • Romanian (Română)
  • Russian (Русский)
  • SpanishES (Español)
  • Swedish (Svenska)
  • Thai (ไทย)
  • Turkish (Türkçe)
  • Ukrainian (Українська)
  • Vietnamese (Tiếng Việt)

License

License

Package Sidebar

Install

npm i sappquestions

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

49.6 kB

Total Files

9

Last publish

Collaborators

  • duckodas