Ensure that only files belonging to torrent are deleted

This commit is contained in:
John Furrow
2017-06-07 21:52:54 -07:00
parent a0e6621873
commit 30a2448509
9 changed files with 214 additions and 103 deletions

View File

@@ -0,0 +1,30 @@
'use strict';
const methodCallUtil = {
getMethodCallConfigFromPropMap(map = new Map(), requestedKeys) {
let desiredKeys = Array.from(map.keys());
if (requestedKeys != null) {
desiredKeys = desiredKeys.filter(key => requestedKeys.includes(key));
}
return desiredKeys.reduce(
(accumulator, key) => {
const {methodCall, transformValue} = map.get(key);
accumulator.methodCalls.push(methodCall);
accumulator.propLabels.push(key);
accumulator.valueTransformations.push(transformValue);
return accumulator;
},
{
methodCalls: [],
propLabels: [],
valueTransformations: []
}
);
}
};
module.exports = methodCallUtil;