Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const self = this;
if (!callback) {
callback = maxAge;
maxAge = 0;
}
const isArray = _.isArray(nodesToRead);
if (!isArray) {
nodesToRead = [nodesToRead];
}
assert(_.isArray(nodesToRead));
assert(_.isFunction(callback));
if (helpAPIChange) {
// the read method deprecation detection and warning
if (!(getFunctionParameterNames(callback)[1] === "dataValues" || getFunctionParameterNames(callback)[1] === "dataValue")) {
console.log("ERROR ClientSession#read API has changed !!, please fix the client code".red);
console.log(" replace ..:".red);
console.log(" session.read(nodesToRead,function(err,nodesToRead,results) {}".cyan);
console.log(" with .... :".red);
console.log(" session.read(nodesToRead,function(err,dataValues) {}".cyan);
console.log("");
console.log("please make sure to refactor your code and check that he second argument of your callback function is named".yellow,("dataValue" + (isArray?"s":"")).cyan);
console.log("to make this exception disappear".yellow);
throw new Error("ERROR ClientSession#read API has changed !!, please fix the client code");
}
}
// coerce nodeIds
for (const node of nodesToRead) {
node.nodeId = resolveNodeId(node.nodeId);
}