npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

super-lucky-guy

v1.2.3

Published

A simplified interface for interacting with various 'starter' games.

Downloads

28

Readme

Super Lucky Guy!

Basic validation npm version

Lucky Guy is a facade class providing a simplified interface for interacting with various "starter" games, such as rolling dice, flipping coins, binary outcomes, and custom lists. It supports multiple languages, making it flexible for different locales.

Features

  • Binary Outcomes: Get either a 0 or 1.
  • Dice Rolling: Roll a dice with customizable sides (default is 6).
  • Coin Flipping: Flip a coin and get localized results like "Heads" or "Tails".
  • Confirmation Games: Get results like "Yes" or "No" based on the selected language.
  • Rock-Paper-Scissors (Jokenpo): Play rock-paper-scissors in different languages.
  • Random Alphabet Letter: Get a random letter from the alphabet.
  • Odds and Evens Game: Sum two numbers and determine the result.
  • Custom List Game: Choose a random option from a provided list.

Supported Languages

The app supports multiple languages:

  • English (en)
  • Portuguese (pt)
  • Spanish (es)
  • French (fr)
  • German (de)
  • Italian (it)
  • Russian (ru)
  • Chinese (zh)
  • Japanese (ja)
  • Arabic (ar)
  • Hindi (hi)

Installation

To use the LuckyGuy class in your project:

npm i super-lucky-guy
import { LuckyGuy } from 'super-lucky-guy';

const lucky = new LuckyGuy(); //'en' - English is default

Methods

| Method | Description | Default Values | Return | | ----------------------------------------------------- | -------------------------------------------------------------------------------- | -------------- | ---------- | | language(language: Language) | Set the current language for localized games. | None | None | | language() | Get the current language being used for localization. | None | Language | | binary() | Play a binary game, returning either 0 or 1. | None | number | | dice(sides) | Roll a dice with the specified number of sides. | 6 | number | | coin() | Flip a coin and get the result in the current language. | None | string | | confirmation() | Receive a confirmation result such as "Yes" or "No". | None | string | | jokenpo() | Play rock-paper-scissors and get the result. | None | string | | alphabet() | Get a random letter from the alphabet in the current language. | None | string | | oddsAndEvens(firstHand: number, secondHand: number) | Play an odds-and-evens game using the sum of two numbers. | None | string | | custom(list: string[]) | Play a custom game and return a randomly selected option from the provided list. | None | string |

Example

const lucky = new LuckyGuy('pt');

// Flip a coin
console.log(lucky.coin()); // Outputs: "Cara" or "Coroa" (Heads or Tails in Portuguese)

// Play rock-paper-scissors
console.log(lucky.jokenpo()); // Outputs: "Pedra", "Papel", or "Tesoura" (Rock, Paper, Scissors in Portuguese)