mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-10 10:06:00 +00:00
refactor(config-protection): build targetPaths without mutation
This commit is contained in:
1 parent
fbb9d34fd1
commit
2a3ed89600
1 file changed
+3
-7
@@ -172,14 +172,10 @@ function run(inputOrRaw, options = {}) {
|
||||
*/
|
||||
function targetPaths(toolInput) {
|
||||
const shared = toolInput?.file_path || toolInput?.file || '';
|
||||
const paths = new Set();
|
||||
if (typeof shared === 'string' && shared) paths.add(shared);
|
||||
const edits = Array.isArray(toolInput?.edits) ? toolInput.edits : [];
|
||||
for (const edit of edits) {
|
||||
const entryPath = edit && typeof edit === 'object' ? edit.file_path : undefined;
|
||||
if (typeof entryPath === 'string' && entryPath) paths.add(entryPath);
|
||||
}
|
||||
return [...paths];
|
||||
const entryPaths = edits.map(edit => (edit && typeof edit === 'object' ? edit.file_path : undefined));
|
||||
const candidates = [shared, ...entryPaths].filter(p => typeof p === 'string' && p);
|
||||
return [...new Set(candidates)];
|
||||
}
|
||||
|
||||
function checkTarget(filePath) {
|
||||
|
||||
Reference in new issue
Block a user