Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
644 B

export function levelup(store) {
return Object.assign(Object.create(store), {
get(key, options, callback) {
let result = store.get(key);
if (typeof options == 'function')
callback = options;
if (callback) {
if (result === undefined)
callback(new NotFoundError());
else
callback(null, result);
} else {
if (result === undefined)
return Promise.reject(new NotFoundError());
else
return Promise.resolve(result);
}
},
});
}
class NotFoundError extends Error {
constructor(message) {
super(message);
this.name = 'NotFoundError';
this.notFound = true;
}
}