We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b529621 + 4817e63 commit 1a36120Copy full SHA for 1a36120
src/referrals/utils/generateReferralCode.ts
@@ -0,0 +1,10 @@
1
+export function generateReferralCode(length = 8): string {
2
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
3
+ let result = '';
4
+
5
+ for (let i = 0; i < length; i++) {
6
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
7
+ }
8
9
+ return result;
10
+}
0 commit comments