Matteo Scandolo | e3ed016 | 2016-12-01 10:09:12 -0800 | [diff] [blame] | 1 | (function () { |
2 | 'use strict'; | ||||
3 | const _ = require('lodash'); | ||||
4 | const clients = []; | ||||
5 | |||||
6 | exports.clients = clients; | ||||
7 | |||||
8 | exports.add = (client) => { | ||||
9 | // TODO check id that client is already there | ||||
10 | if(!_.find(clients, ({id: client.id}))) { | ||||
11 | clients.push(client); | ||||
12 | } | ||||
13 | } | ||||
14 | |||||
15 | exports.remove = (client) => { | ||||
16 | _.remove(clients, {id: client.id}); | ||||
17 | } | ||||
18 | })(); |