| 1 | const path = require('path'); |
| 2 | const { JsonStore } = require('./store'); |
| 3 | |
| 4 | const DATA_DIR = path.join(__dirname, '..', 'data'); |
| 5 | |
| 6 | let _users = null; |
| 7 | let _repos = null; |
| 8 | |
| 9 | function users() { |
| 10 | if (!_users) _users = new JsonStore(path.join(DATA_DIR, 'users.json'), {}); |
| 11 | return _users; |
| 12 | } |
| 13 | |
| 14 | function repos() { |
| 15 | if (!_repos) _repos = new JsonStore(path.join(DATA_DIR, 'repos.json'), {}); |
| 16 | return _repos; |
| 17 | } |
| 18 | |
| 19 | module.exports = { users, repos }; |
| 20 |