forked from fossasia/publiccode.asia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signatures.js
32 lines (28 loc) · 861 Bytes
/
signatures.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
var fs = require('fs');
var obj = require('./signatures.json');
function forEach(obj, fn, path) {
if (obj && typeof obj == "object")
Object.keys(obj).forEach(function(key) {
var deepPath = path ? path + '.' + key : key;
// Note that we always use obj[key] because it might be mutated by forEach
if (fn.call(obj, obj[key], key, obj, deepPath))
forEach(obj[key], fn, deepPath);
})
}
var table = [];
forEach(obj, function(thing, key, obj, path) {
var thingy;
if (thing.email) {
thingy = {
"include_vars": thing
}
thingy.timestamp = thing.timestamp
table.push(thingy)
return false
} else {
return true
}
});
fs.writeFile("signatures.json", JSON.stringify(table), "UTF-8", function(a) {
a && console.log(a)
})