-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
60 lines (56 loc) · 1.44 KB
/
index.js
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
51
52
53
54
55
56
57
58
59
60
const util = require('util');
var fs = require('fs');
var CardCollection = require('./lib/getCardCollection');
var cardCollection = new CardCollection();
var UsersCard = require('./lib/getUsersCard');
var inv = new UsersCard();
var compleat = [];
var notCompleat = [];
/**
* [description]
* @param {sting} steam api name eller steam64
* @param {int} 1: steam api name 2: steam64
*/
inv.getInvCollection('quer_the_gamer', 1, function (data) {
//console.log(data);
//console.log(util.inspect(data, false, null));
fs.writeFile('gamle.json', JSON.stringify(data), function(err2) {
if(err2) {
throw err2;
}
console.log("The file was saved!");
});
var keys = Object.keys(data);
customforEach(data, keys, 0, function () {
console.log("done");
console.log(compleat);
console.log(countEnd());
console.log(notCompleat);
})
});
function customforEach(data, keys, indexKey, callback) {
if (keys.length > indexKey && data[keys[indexKey]]) {
cardCollection.checkApp(data[keys[indexKey]], keys[indexKey], function (set) {
if(set != null){
compleat.push(set);
console.log("null - no");
}else{
notCompleat.push(keys[indexKey]);
console.log("null");
}
customforEach(data, keys, ++indexKey, callback)
});
} else {
callback();
}
}
function countEnd() {
var end = {
setsTypes: compleat.length,
sets: 0
};
for (var i = 0; i < compleat.length; i++) {
end.sets += compleat[i].length;
}
return end;
}