Allow get and keys to be called without callback

This commit is contained in:
HirokiUchikawa
2018-07-27 21:33:38 +09:00
parent 4e549dd426
commit 6533a9793c
3 changed files with 131 additions and 60 deletions

View File

@@ -220,7 +220,7 @@ function createContext(id,seed) {
callback = storage;
storage = "_";
}
if (typeof callback !== 'function'){
if (callback && typeof callback !== 'function'){
throw new Error("Callback must be a function");
}
context = getContextStorage(storage);
@@ -279,7 +279,7 @@ function createContext(id,seed) {
callback = storage;
storage = "_";
}
if (typeof callback !== 'function') {
if (callback && typeof callback !== 'function') {
throw new Error("Callback must be a function");
}
context = getContextStorage(storage);