@sash/promo.generator
v1.0.2
Published
The library allows you to generate promotional codes. You can start from any position. The character set can also be customized.
Downloads
6
Readme
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