Last active
April 26, 2022 15:57
-
-
Save Hibrix-net/a28efe8ba860474ce5180978fab12dfa to your computer and use it in GitHub Desktop.
Random object properties generator (example with 5.000 properties: keys with 21 chars, values with 6 chars)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = {}; | |
for (let index = 0; index < 5000; index++) { | |
obj[makeid(21)] = makeid(6); | |
} | |
function makeid(length) { | |
let result = ''; | |
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
const charactersLength = characters.length; | |
for (let i = 0; i < length; i++) { | |
result += characters.charAt(Math.floor(Math.random() * charactersLength)); | |
} | |
return result; | |
} | |
copy(obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment