New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

randomizersameer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

randomizersameer

A lightweight utility for randomizing strings, shuffling characters, and generating random string sequences in JavaScript.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

randomizersameer

randomizersameer is a simple Node.js package that randomizes the characters of a given string. It takes an input string, shuffles its characters, and returns the randomized version of that string.

Installation

You can install randomizersameer via npm:

npm install randomizersameer

Usage

To use the package, simply require it in your project and pass a string to the randomize function. It will return a randomized version of the input string.

Example

const randomize = require("randomizersameer");

const randomizedString = randomize("hello world");
console.log(randomizedString); // Outputs a shuffled version of "hello world", e.g., "odlleh wlro"

API

randomize(s: string)

  • Parameters:

    • s (string): The string to be randomized.
  • Returns:

    • A new string with the characters of the input string shuffled randomly.
  • Throws:

    • An error if the input is not a string.

Example

const randomize = require("randomizersameer");

// Correct usage
console.log(randomize("example")); // Outputs: "maxpele", "pmaleex", etc.

// Incorrect usage
console.log(randomize(12345)); // Throws: Error: It should be a string

Error Handling

If the input is not of type string, the function throws an error:

throw new Error("It should be a string");

Keywords

string

FAQs

Package last updated on 02 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts