1
0
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:
Nick O'Leary 2018-07-25 09:59:26 +01:00
parent 315a9ceba3
commit 17e6940a42
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 5 additions and 5 deletions

View File

@ -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(){

View File

@ -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) {