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

slangs

v1.0.0-beta.7

Published

Add fun to your conversations with this slang generator, offering playful slangs in multiple languages for you and your friends!

Downloads

44

Readme

slangs Downloads

Overview

The slangs package provides a simple and efficient way to retrieve slang words in multiple languages, including English, Bengali, and French. Users can fetch all available slangs, get random slangs from a specific language, and even specify the number of slangs they want to receive.

Installation

To install the slangs package, simply include it in your project:

npm License Downloads

 npm install slangs

| Package Manager | Command | | --------------- | ----------------- | | Yarn | yarn add slangs | | PNPM | pnpm add slangs | | BUN | bun add slangs |

Usage

Importing the Package

To use the slangs package in your project, you can import it using CommonJS syntax:

const { slangs, random, languages } = require('slangs');

For projects using ES6 modules, you can also import it as follows:

import { slangs, random, languages } from 'slangs';

Functionality slangs, random, and languages

The slangs function supports the following parameters:

  • language: A string specifying the language for which you want to retrieve slangs. Supported languages include:

    • english
    • bengali
    • french
  • count: An optional integer specifying the number of slangs to return. Defaults to 1 if not provided.

Example Usage languages

  • The languages function retrieves the list of supported languages for the slangs package.

  • To get the list of supported languages, you can call the languages function:

const { languages } = require('slangs');

// Get the list of supported languages
console.log(languages());
// Returns an array of supported languages

Example Usage slangs

To use the slangs package in your project, you can use the following examples:

  1. Get All Slangs

    To get all available slangs from the package:

    const { slangs } = require('slangs');
    console.log(slangs());
  2. Get a Random Slang

    To get a slang from a specific language:

    console.log(slangs('bengali'));
  3. Get Multiple Slangs

    To get a specific number of slangs from a given language:

    console.log(slangs('english', 3));
    // Get 3  English slangs

    If the requested number exceeds the available slangs, the function will return only the available ones.

  4. Unsupported Language Handling

    If a language is not supported, the function will return a message indicating that support is unavailable:

    console.log(slangs('spanish', 2));
    // Returns "Sorry, we don't support spanish yet."

Return Values

  • When a valid language is specified, the function returns an array of slangs.
  • If the language is unsupported, it returns a string message indicating the lack of support.

Example Usage random

  1. Get All random Slangs

    To get all available slangs from the package:

    console.log(random());
  2. Get a Random Slang

    To get a random slang from a specific language:

    console.log(random('bengali'));
  3. Get Multiple Random Slangs

    To get a specific number of random slangs from a given language:

    console.log(random('english', 3));
    // Get 3 random English slangs

    If the requested number exceeds the available slangs, the function will return only the available ones.

  4. Unsupported Language Handling

    If a language is not supported, the function will return a message indicating that support is unavailable:

    console.log(random('spanish', 2));
    // Returns "Sorry, we don't support spanish yet."

Return Values

  • When a valid language is specified, the function returns anrandom array of slangs.
  • If the language is unsupported, it returns a string message indicating the lack of support.

Example Implementation

Here’s a full example of how to implement the slangs package:

const { slangs, random, languages } = require('slangs');

// Get the list of supported languages
console.log(languages());
// Returns an array of supported languages

// Get all slangs
console.log(slangs());

// Get all random slangs
console.log(random());

// Get a  Bengali slang
console.log(slangs('bengali'));

// Get a random Bengali slang
console.log(random('bengali'));

// Get 4  Bengali slangs
console.log(slangs('bengali', 4));

// Get 4 random Bengali slangs
console.log(random('bengali', 4));

// Get 3 slangs from English
console.log(slangs('english', 3));

// Get 3 random slangs from English
console.log(slangs('english', 3));

// Get slangs from an unsupported language
console.log(slangs('spanish', 2));
// Returns "Sorry, we don't support spanish yet."

// Get random slangs from an unsupported language
console.log(random('spanish', 2));
// Returns "Sorry, we don't support spanish yet."

Contributing

Contributions to the slangs package are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.