UNPKG

otp-generator-module

Version:

A simple and flexible OTP (One-Time Password) generator module for JavaScript and TypeScript. Supports numeric, alphabetic, and special character combinations with customizable options.

15 lines (14 loc) 614 B
import { generateOTP } from './index.js'; console.log('Default (4-digit numeric):', generateOTP()); const boolOptions = [true, false]; let count = 1; for (const upperCase of boolOptions) { for (const alphabets of boolOptions) { for (const specialChars of boolOptions) { if (!upperCase && !alphabets && !specialChars) continue; const options = { length: 6, upperCase, alphabets, specialChars }; console.log(`Combo ${count++} (upperCase: ${upperCase}, alphabets: ${alphabets}, specialChars: ${specialChars}):`, generateOTP(options)); } } }