-
Notifications
You must be signed in to change notification settings - Fork 105
/
fixScript.js
31 lines (29 loc) · 859 Bytes
/
fixScript.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
var p = fetch('https://starwarsopening.firebaseio.com/openings.json');
p.then(function(data){
return data.json();
}).then(function(data){
var keys = Object.keys(data);
var c = 0;
for(var i=0;i<keys.length;i++){
var k = keys[i];
var obj = data[k];
if(obj.text == "321321321"){
c++;
var fb = new Firebase('https://starwarsopening.firebaseio.com/openings/'+k);
//fb.on("value", function(snapshot) {
// var o = snapshot.val();
// console.log(o);
//});
fb.remove();
}
}
console.log(c);
});
// count script
var p = fetch('https://starwarsopening.firebaseio.com/openings.json');
p.then(function(data){
return data.json();
}).then(function(data){
var keys = Object.keys(data);
console.log(keys.length);
});