-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
34 lines (29 loc) · 821 Bytes
/
script.js
File metadata and controls
34 lines (29 loc) · 821 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
25
26
27
28
29
30
31
32
33
34
/**
* Given a JSON array of history items and a set of bookmarks
* (represented as an object literal),
* iterates through the bookmarks, finding the history item for each,
* and adds the history data to it
*/
(function () {
'use strict';
var fs = require('fs-extra'),
data = fs.readJsonSync('./data.json'),
users = [];
// });
readInUsers();
writeUsersToJson();
function readInUsers() {
data.forEach(function (dataItem, idx, arr) {
console.log(dataItem['user']);
users.push(dataItem['user']);
// if (bookmarks[historyItem.url]) {
// bookmarks[historyItem.url].history = historyItem;
// }
});
}
function writeUsersToJson() {
fs.outputJson('./users.json', users, function (err) {
if (err) { console.log(err); }
});
}
})();