@sash/promo.generator
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

promo.generator

The library allows you to generate promotional codes. You can start from any position. The character set can also be customized.

Example:

import { info } from 'console';
import { PromoGenerator } from '@sash/promo.generator';

const cr = new PromoGenerator('#####9', 35221);

info(`number of combinations: ${cr.getCombinations()}`);
info(`CODE: ${cr.next()}`);
info(`CODE: ${cr.next()}`);
info(`CODE: ${cr.next()}`);

// result
// number of combinations: 352218537
// CODE: AADVV5
// CODE: AADVV6
// CODE: AADVV7
const { info } = require('console');
const { PromoGenerator } = require('@sash/promo.generator');

const cr = new PromoGenerator('#####9', 35221);

info(`number of combinations: ${cr.getCombinations()}`);
info(`CODE: ${cr.next()}`);
info(`CODE: ${cr.next()}`);
info(`CODE: ${cr.next()}`);

// result
// number of combinations: 352218537
// CODE: AADVV5
// CODE: AADVV6
// CODE: AADVV7

/@sash/promo.generator/

    Package Sidebar

    Install

    npm i @sash/promo.generator

    Weekly Downloads

    3

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    16.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • sash