Primeiro commit do projeto Angular
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user