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){ if(data){
data = JSON.parse(data); data = JSON.parse(data);
if (!Array.isArray(key)) { if (!Array.isArray(key)) {
callback(null, util.getMessageProperty(data,key)); callback(null, util.getObjectProperty(data,key));
} else { } else {
var results = [undefined]; var results = [undefined];
for (var i=0;i<key.length;i++) { 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); callback.apply(null,results);
} }
@ -212,7 +212,7 @@ LocalFileSystem.prototype.set = function(scope, key, value, callback) {
if (i<value.length) { if (i<value.length) {
v = value[i]; 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"); return fs.outputFile(storagePath + ".json", JSON.stringify(obj, undefined, 4), "utf8");
}).then(function(){ }).then(function(){

View File

@ -32,7 +32,7 @@ Memory.prototype._getOne = function(scope, key) {
var value; var value;
var error; var error;
if(this.data[scope]){ if(this.data[scope]){
value = util.getMessageProperty(this.data[scope], key); value = util.getObjectProperty(this.data[scope], key);
} }
return value; return value;
} }
@ -95,7 +95,7 @@ Memory.prototype.set = function(scope, key, value, callback) {
if (i < value.length) { if (i < value.length) {
v = value[i]; v = value[i];
} }
util.setMessageProperty(this.data[scope],key[i],v); util.setObjectProperty(this.data[scope],key[i],v);
} }
} catch(err) { } catch(err) {
if (callback) { if (callback) {