mirror of
https://github.com/zoriya/flood.git
synced 2025-12-19 21:55:15 +00:00
Ensure that only files belonging to torrent are deleted
This commit is contained in:
30
server/util/methodCallUtil.js
Normal file
30
server/util/methodCallUtil.js
Normal 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;
|
||||
Reference in New Issue
Block a user