Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abcq

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abcq

Generates character combinations from numbers: `a b c ... aa ab ac ... foo fop foq`

  • 1.0.1
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

abcq

Generates character combinations from numbers: a b c ... aa ab ac ... foo fop foq

Documentation

npm

  • Convert numbers to character combinations.
  • Count by character combination
  • Create unique ids
  • Create simple hashes
npm i abcq
## or
yarn add abcq

Basic usage

import Abcq from "abcq";
const shortid = new Abcq();

shortid.generate();
// -> a
shortid.generate();
// -> b
shortid.encode(1234567890);
// -> clRjXk
shortid.decode("clRjXk");
// -> 1234567890

When unicorns make love

Use an Array for chars if it contains special characters. Set the counter to modify the start point

import Abcq from "abcq";

const unicornLove = new Abcq({
	chars: ["🦄", "💖"],
	counter: 42
});

unicornLove.generate();
// -> 🦄💖💖🦄💖
unicornLove.encode(8);
// -> 🦄💖🦄

Options

chars

  • type: { string[] | string }
  • default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

counter

  • type: { number }
  • default: -1

Methods

generate

import Abcq from "abcq";
const abc = new AbcQ();
abc.generate();
// -> a
abc.generate();
// -> b

encode

import Abcq from "abcq";
const abc = new AbcQ();
abc.encode(1234567890);
// -> clRjXk

decode

import Abcq from "abcq";
const abc = new AbcQ();********
abc.decode("clRjXk");
// -> 1234567890

FAQs

Package last updated on 24 Sep 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc