@hedgewizard.dev/random-facts
v0.2.0
Published
Random dinosaur facts generator
Readme
@hedgewizard.dev/random-facts
A simple utility package that provides random dinosaur facts.
Installation
npm install @hedgewizard.dev/random-factsUsage
import { getFact } from '@hedgewizard.dev/random-facts';
// Get a random dinosaur fact
const fact = getFact();
console.log(fact);
// Output: "Tyrannosaurus rex had teeth up to 8 inches long, but they were shaped like bananas rather than sharp knives."
// Get multiple facts
for (let i = 0; i < 3; i++) {
console.log(`${i + 1}. ${getFact()}`);
}API
getFact(): string
Returns a random dinosaur fact from an internal collection of 10 facts.
Returns: A string containing a random dinosaur fact.
Example:
const fact = getFact();
console.log(typeof fact); // "string"
console.log(fact.length > 0); // trueFeatures
- 🦕 10 carefully curated dinosaur facts
- 🎲 Uses
Math.random()for randomness (no external dependencies) - 📝 Written in TypeScript with full type definitions
- 🧪 Thoroughly tested with Vitest
- 📦 Zero dependencies
- 🔒 Immutable fact collection
License
MIT © Hedgewizard.dev
Contributing
This package is part of the hw-utils monorepo. Please see the main repository for contribution guidelines.
