A simple TypeScript package for generating unique coupon codes and random slugs. This package provides two main functionalities: generating coupon codes with various options and creating random slugs from a predefined list of words.
To install the package, run:
npm install slugmaster
import { generateCouponCode } from 'slugmaster';
const couponCode = generateCouponCode({
length: 10,
prefix: 'SAVE',
type: 'alphanumeric',
includeLowercase: true,
includeSymbols: false
});
import { generateSlug } from 'slugmaster';
const slug = generateSlug({
wordCount: 3
});
length
: Length of the coupon code (default: 6)type
: Character types (alpha
,alphanumeric
,numeric
)prefix
: Prefix for the coupon code (default: 'CP')includeLowercase
: Include lowercase letters (default: false)includeSymbols
: Include special characters (default: false)
wordCount
: Number of words in the slug (default: 3)randomStringLength
: Length of the random string to append (default: 0)