mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-23 20:07:40 +02:00
17c8fe7710
fixes: #587 Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
26 lines
588 B
JavaScript
26 lines
588 B
JavaScript
'use strict';
|
|
|
|
module.exports = () => {
|
|
const _addons = [];
|
|
|
|
return {
|
|
insert: async addon => {
|
|
const a = { id: _addons.length, ...addon };
|
|
_addons.push(a);
|
|
return a;
|
|
},
|
|
update: async (id, value) => {
|
|
_addons[id] = value;
|
|
Promise.resolve(value);
|
|
},
|
|
delete: async id => {
|
|
_addons.splice(id, 1);
|
|
Promise.resolve();
|
|
},
|
|
get: async id => {
|
|
return _addons.find(id);
|
|
},
|
|
getAll: () => Promise.resolve(_addons),
|
|
};
|
|
};
|