Skip to content

Instantly share code, notes, and snippets.

@vishalwayachal
Last active April 6, 2022 09:46
Show Gist options
  • Save vishalwayachal/cb23207676e5d0ba520cfe0ad2f5f6b3 to your computer and use it in GitHub Desktop.
Save vishalwayachal/cb23207676e5d0ba520cfe0ad2f5f6b3 to your computer and use it in GitHub Desktop.
Generate Fake VCF file in JAVASCRIPT
loopindex = 100
vcftext = ``
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 5; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function zeroPad(num) {
return num.toString().padStart(3, "0");
}
for (let step = 0; step < 200; step++) {
nameInit = makeid()
vcftext +=`BEGIN:VCARD
VERSION:3.0
N:;${nameInit}_NAME+${step};;;
FN:${nameInit}_NAME+${step}
LATESTDATE:202001112035
COUNTRYISO:ID
OPPO_RECENT_CALL:NULL
TEL;CELL:+914444444${zeroPad(step)}
END:VCARD
`
}
console.log(vcftext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment