Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return
}
// Put the err arg back
results.unshift(undefined);
callback.apply(null,results);
});
}
} else {
// No callback, attempt to do this synchronously
var results = context.get(scope,key);
if (seed) {
if (Array.isArray(key)) {
insertSeedValues(key,results);
} else if (results === undefined){
try {
results = util.getObjectProperty(seed,key);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
results = undefined;
}
}
}
return results;
}
}
},
data = JSON.parse(data);
if (!Array.isArray(key)) {
try {
value = util.getObjectProperty(data,key);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
value = undefined;
}
callback(null, value);
} else {
var results = [undefined];
for (var i=0;i
loadFile(storagePath + ".json").then(function(data){
var value;
if(data){
data = JSON.parse(data);
if (!Array.isArray(key)) {
try {
value = util.getObjectProperty(data,key);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
value = undefined;
}
callback(null, value);
} else {
var results = [undefined];
for (var i=0;i
Memory.prototype._getOne = function(scope, key) {
var value;
var error;
if(this.data[scope]){
try {
value = util.getObjectProperty(this.data[scope], key);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
value = undefined;
}
}
return value;
}
if (!Array.isArray(keys)) {
if (values[0] === undefined) {
try {
values[0] = util.getObjectProperty(seed,keys);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
values[0] = undefined;
}
}
} else {
for (var i=0;i
insertSeedValues = function(keys,values) {
if (!Array.isArray(keys)) {
if (values[0] === undefined) {
try {
values[0] = util.getObjectProperty(seed,keys);
} catch(err) {
if (err.code === "INVALID_EXPR") {
throw err;
}
values[0] = undefined;
}
}
} else {
for (var i=0;i