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

permugenjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

permugenjs

permugenjs is an NPM package that generates all possible permutations (not just combinations) of a given string.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

permugenjs

permugenjs is an NPM package that generates all possible permutations (not just combinations) of a given string.

📌 What Does “All Possible Combinations” Mean?

Given an input string, this tool returns all the possible unique permutations of its characters.

Example: If the input string is: ABCD Then the total number of permutations is 4! = 24.

Sample output:

 [
        "1342",
        "1432",
        "2341",
        "2431",
        "1243",
        "1423",
        "3241",
        "3421",
        "2143",
        "2413",
        "3142",
        "3412",
        "4231",
        "4321",
        "1234",
        "1324",
        "4132",
        "4312",
        "2134",
        "2314",
        "4123",
        "4213",
        "3124",
        "3214"
    ]

✅ Validation Rules The input string must satisfy the following conditions: 1.Input must be a valid string 2.Only letters and numbers are allowed (a-z, A-Z, 0-9) 3.Special characters like &^%@#$!~,/|{}](*)+-` are not allowed 4.The input string must contain at least 2 and at most 10 characters

📦 Installation

npm install permugenjs

🧑‍💻 TypeScript Support

This package is fully compatible with TypeScript.

📘 Usage

React ->


import { getCombinationsGenerator } from "permugenjs";

export default function MainComponent() {
  return (
    <div>
      <label>Enter a number </label>
      <input name="val" id="val" />
      <button
        onClick={(e) => {
          let inputParam = document.getElementById("val").value;
          const promiseData = getCombinationsGenerator(inputParam);
          promiseData
            .then(function (res) {
              console.log("res====>", res);
            })
            .catch((err) => {
              console.log(err);
            });
        }}
      >
        Enter
      </button>
    </div>
  );
}


Node JS with .js file (with CommonJS)


const express = require('express');
const pkg = require('permugenjs');

const app = express ();
const {getCombinationsGenerator} = pkg;

app.use(express.json());
const PORT = process.env.PORT || 6000;
app.listen(PORT, () => {
    console.log("Server Listening on PORT:", PORT);
});


app.get("/status", async (request, response) => {
    const req = request.query.input;

    const combinations=getCombinationsGenerator(String(req));
    combinations.then((res)=>{
        const status = {
            combinations: res,
            Status: "Running"
         };    
         response.send(status);
    })
 });  

Node JS with .mjs file (with ESM)


import  express from 'express';
import {getCombinationsGenerator} from 'permugenjs';
const app = express ();

app.use(express.json());
const PORT = process.env.PORT || 6000;
app.listen(PORT, () => {
    console.log("Server Listening on PORT:", PORT);
});


app.get("/status", async (request, response) => {
    const req = request.query.input;
    const combinations=getCombinationsGenerator(String(req));
    combinations.then((res)=>{
        const status = {
            combinations: res,
            Status: "Running"
         };    
         response.send(status);
    })    
 });  

Output -->


{
    "combinations": [
        "airb",
        "arib",
        "bira",
        "bria",
        "abri",
        "arbi",
        "ibra",
        "irba",
        "bari",
        "brai",
        "iarb",
        "irab",
        "rbia",
        "riba",
        "abir",
        "aibr",
        "raib",
        "riab",
        "bair",
        "biar",
        "rabi",
        "rbai",
        "iabr",
        "ibar"
    ],
    "Status": "Running"
}

✅ The function has built-in type definitions: generateCombinations(input: string): string[]

🚀 Performance Notes The function uses a recursive algorithm to generate all permutations. The time complexity is O(n!), where n is the number of characters in the string. For performance reasons, it's recommended to limit input length to 10 characters or fewer. Generating permutations for strings longer than 10 characters may cause performance issues or memory exhaustion.

Input Length Estimated Permutations

TimeMemoryUsage
424Fast(🟢)
6720Moderate(🟡)
840,320High(🔴)
103,628,800Very High(🚨)

Creator's Note


Dear user,
Thank you for visiting and using the permugenjs npm package.
Currently, the repository is private due to certain reasons.

If you encounter any issues, please feel free to email me at abirlalmukherjee786@gmail.com with the subject line:
Current Date|Permugenjs Issue – Your Name

I’ll do my best to address and resolve the issue as soon as possible.

Best regards,
Abirlal Mukherjee

Contribution is Close

FAQs

Package last updated on 09 Jun 2025

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