Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
VirtualBoxManager.checkpointExists = function (checkpointName, callback, dontAddPrefix)
{
if (!dontAddPrefix)
{
checkpointName = VirtualBoxManager.snapshotPrefix + checkpointName;
}
if (Config.virtualbox && Config.virtualbox.active)
{
const virtualbox = require("virtualbox");
virtualbox.snapshotList(VirtualBoxManager.vmName, function (error, snapshotList, currentSnapshotUUID)
{
if (isNull(error))
{
if (snapshotList && snapshotList instanceof Array)
{
const matchingSnapshots = _.filter(snapshotList, function (snapshot)
{
return snapshot.name === checkpointName;
});
if (matchingSnapshots.length > 0)
{
callback(null, true);
}
else
{