Welcome to the lakshya
npm package! This package provides a few useful utilities, including functions for checking pangrams, generating random playing cards, and creating a promise that simulates a random event.
You can install this package via npm:
npm install lakshya
Checks if a given string is a pangram (a sentence that contains every letter of the alphabet at least once).
Parameters:
-
string
(string): The string to be checked.
Returns:
-
boolean
:true
if the string is a pangram,false
otherwise.
Example:
const { isPangram } = require('lakshya');
console.log(isPangram('The quick brown fox jumps over the lazy dog')); // true
console.log(isPangram('Hello, world!')); // false
Generates a random playing card with a value and a suit.
Returns:
-
object
: An object with two properties:-
Value
(string): The value of the card (e.g., '2', 'J', 'A'). -
Suit
(string): The suit of the card (e.g., 'Clubs', 'Hearts').
-
Example:
const { getCard } = require('lakshya');
const card = getCard();
console.log(card); // { Value: '5', Suit: 'Hearts' }
Returns a promise that randomly resolves or rejects after 5 seconds. The promise resolves with a message indicating success or rejects with a message indicating failure.
Returns:
-
Promise
: A promise that either resolves with 'YEHHH DOGGGG!!!!' or rejects with 'NO DOG :('.
Example:
const { makeDogPromise } = require('lakshya');
makeDogPromise()
.then(() => {
console.log('Promise resolved: YEHHH DOGGGG!!!!');
})
.catch(() => {
console.log('Promise rejected: NO DOG :(');
});
This package is licensed under the ISC License. See the LICENSE file for more information.
Lakshya Bhatia