mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Update context plugins to use get/setObjectProperty
This commit is contained in:
parent
315a9ceba3
commit
17e6940a42
@ -171,11 +171,11 @@ LocalFileSystem.prototype.get = function(scope, key, callback) {
|
||||
if(data){
|
||||
data = JSON.parse(data);
|
||||
if (!Array.isArray(key)) {
|
||||
callback(null, util.getMessageProperty(data,key));
|
||||
callback(null, util.getObjectProperty(data,key));
|
||||
} else {
|
||||
var results = [undefined];
|
||||
for (var i=0;i<key.length;i++) {
|
||||
results.push(util.getMessageProperty(data,key[i]))
|
||||
results.push(util.getObjectProperty(data,key[i]))
|
||||
}
|
||||
callback.apply(null,results);
|
||||
}
|
||||
@ -212,7 +212,7 @@ LocalFileSystem.prototype.set = function(scope, key, value, callback) {
|
||||
if (i<value.length) {
|
||||
v = value[i];
|
||||
}
|
||||
util.setMessageProperty(obj,key[i],v);
|
||||
util.setObjectProperty(obj,key[i],v);
|
||||
}
|
||||
return fs.outputFile(storagePath + ".json", JSON.stringify(obj, undefined, 4), "utf8");
|
||||
}).then(function(){
|
||||
|
@ -32,7 +32,7 @@ Memory.prototype._getOne = function(scope, key) {
|
||||
var value;
|
||||
var error;
|
||||
if(this.data[scope]){
|
||||
value = util.getMessageProperty(this.data[scope], key);
|
||||
value = util.getObjectProperty(this.data[scope], key);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -95,7 +95,7 @@ Memory.prototype.set = function(scope, key, value, callback) {
|
||||
if (i < value.length) {
|
||||
v = value[i];
|
||||
}
|
||||
util.setMessageProperty(this.data[scope],key[i],v);
|
||||
util.setObjectProperty(this.data[scope],key[i],v);
|
||||
}
|
||||
} catch(err) {
|
||||
if (callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user