1
0
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:
Steve-Mcl 2021-05-25 14:53:06 +01:00
parent 4f77bbeb2b
commit 4d768fd236

View File

@ -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;