-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
50 lines (36 loc) · 1.09 KB
/
api.js
File metadata and controls
50 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const startTime = performance.now();
async function getUserInfo(userArray){
let url = 'https://api.github.com/users/';
var found =0 ;
var notFound = 0;
function showme(data){
if(!data.id){
notFound +=1;
// console.log("not found : ",notFound)
}
else{
found +=1;
// console.log("found : ",found)
}
}
userArray.forEach(user => {
fetch(url + user,{
method:"GET",
headers:{
Authorization: 'Bearer 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'
}
}).then((response)=>{
return response.json()
})
.then((data)=>{
showme(data)
})
})
setTimeout(()=>{
console.log("found : ",found,"Not found :",notFound)
const endTime = performance.now();
console.log("Script execution time:", endTime - startTime , "milliseconds");
},500)
}
getUserInfo(['nirav','sagar','vijay','nirav-improwised']);
// /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