forked from srijanpaul-deepsource/bad-javascript-stuff
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
Latest commit
24 lines (19 loc) · 674 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (19 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
constfs=require('fs');
// Function to generate a TypeScript object with 10 keys
functiongenerateObject(index){
letobjectContent=`const obj${index} = {\n`;
for(leti=0;i<10;i++){
objectContent+=` key${i}: 'value${index}_${i}',\n`;
}
objectContent+=`};\n\n`;
returnobjectContent;
}
// Specify the number of objects you want to generate
consttotalObjects=1000;
letcode='';
for(leti=0;i<totalObjects;i++){
code+=generateObject(i);
}
// Write the generated code to a .ts file
fs.writeFileSync('LargeTypeScriptFile.ts',code);
console.log('Generated LargeTypeScriptFile.ts with 1000 objects, each containing 10 keys.');