mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
ensure context get/set key is a string
This commit is contained in:
parent
4f77bbeb2b
commit
4d768fd236
@ -256,6 +256,9 @@ function createContext(id,seed,parent) {
|
||||
value: function(key, storage, callback) {
|
||||
var context;
|
||||
|
||||
if (typeof key !== "string" || !key.length) {
|
||||
throw new Error("context get() requires 'key' to be a valid string");
|
||||
}
|
||||
if (!callback && typeof storage === 'function') {
|
||||
callback = storage;
|
||||
storage = undefined;
|
||||
@ -338,6 +341,9 @@ function createContext(id,seed,parent) {
|
||||
value: function(key, value, storage, callback) {
|
||||
var context;
|
||||
|
||||
if (typeof key !== "string" || !key.length) {
|
||||
throw new Error("context set() requires 'key' to be a valid string");
|
||||
}
|
||||
if (!callback && typeof storage === 'function') {
|
||||
callback = storage;
|
||||
storage = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user