Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sapphdevelopment/sappquotes
https://github.com/sapphdevelopment/sappquotes
quote quote-generator quotes
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sapphdevelopment/sappquotes
- Owner: SapphDevelopment
- License: mit
- Created: 2023-06-16T23:32:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-11T00:59:47.000Z (over 1 year ago)
- Last Synced: 2024-11-09T11:22:45.141Z (2 months ago)
- Topics: quote, quote-generator, quotes
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/sappquotes
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sappQuotes
sappQuotes is a very lightweight npm package that provides a collection of quotes with various categories. It allows you to retrieve random quotes or quotes from specific categories. All quotes were manually curated, ensuring no duplicates, no API reliance, and no downtime.
## Installation
You can install sappQuotes using npm:
```shh
npm install sappquotes@latest
```## Usage
Here's an example how to use sappQuotes:
```typescript
/* JavaScript */ const { getRandomQuote, countQuotes, fetchQuotes, fetchCategories } = require("sappquotes")
/* TypeScrippt */ import { getRandomQuote, countQuotes, fetchQuotes, fetchCategories } from "sappquotes"// Fetch and display a random quote
await getRandomQuote().then((quote) => {
console.log(`"${quote.quote}" - ${quote.author}`);
});// Fetch and display a random quote from a specific category
const category = "motivation";
await getRandomQuote(category).then((quote) => {
console.log(`"${quote.quote}" - ${quote.author} (${quote.category})`);
});// Fetch and display available categories
await fetchCategories().then((categories) => {
console.log("Available categories:", categories);
});// Fetch and display available quotes
await fetchQuotes().then((quotes) => {
console.log("Available quotes:", quotes);
});
```## API
The sappQuotes package provides the following functions:
### `getRandomQuote`
Retrieve a random quote from any category.
### `getRandomQuote(category: string)`
Retrieve a random quote from a specific category.
- `category`: The category from which to retrieve the quote.
### `fetchQuotes`
Retrieve all available quotes.
### `fetchCategories`
Retrieve all available categories.
## License
MIT License
Copyright (c) 2023 Sapphire Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.