A collection of utility functions with faker integration for generating random animal names.
-
Install Node.js and npm (if not already installed):
- Download from: https://nodejs.org/
- Or use a package manager like Chocolatey:
choco install nodejs
-
Install dependencies:
npm install
- String manipulation utilities (
removeAllChar,replaceAllChar, etc.) - Array utilities (
sortArray,removeDuplicate,longestWord, etc.) - String analysis (
isPalindrome,reverseString, etc.)
generateRandomAnimalName()- Generates a single random animal namegenerateMultipleAnimalNames(count)- Generates multiple random animal namesgenerateAnimalWithContext()- Generates an animal with additional context (color, habitat, description)
npm start
# or
node trigger.jsconst { generateRandomAnimalName, generateMultipleAnimalNames, generateAnimalWithContext } = require('./faker-utils');
// Generate a single animal name
console.log(generateRandomAnimalName()); // e.g., "Lion"
// Generate multiple animal names
console.log(generateMultipleAnimalNames(3)); // e.g., ["Elephant", "Giraffe", "Penguin"]
// Generate animal with context
console.log(generateAnimalWithContext());
// Output: {
// name: "Tiger",
// color: "Blue",
// habitat: "Tropical Rainforest",
// description: "A majestic creature..."
// }package.json- Project configuration and dependenciesfaker-utils.js- Faker integration and animal name generation functionscode.js- Original utility functionsinc.js- Basic arithmetic functionstrigger.js- Demo script showing faker functionality
@faker-js/faker- For generating random data including animal names