mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Adapt per review
This commit is contained in:
parent
aa7bbbd4e9
commit
d84270be8d
4 changed files with 76 additions and 36 deletions
|
|
@ -10,7 +10,10 @@ export function getEquivalentPackageNames(packageName, ecosystem) {
|
|||
return [packageName];
|
||||
}
|
||||
|
||||
return [...new Set([packageName, ...["-", "_", "."].map((separator) =>
|
||||
packageName.replaceAll(/[._-]/g, separator)
|
||||
)])];
|
||||
const pythonSeparatorPattern = /[._-]/g;
|
||||
const hyphenName = packageName.replaceAll(pythonSeparatorPattern, "-");
|
||||
const underscoreName = packageName.replaceAll(pythonSeparatorPattern, "_");
|
||||
const dotName = packageName.replaceAll(pythonSeparatorPattern, ".");
|
||||
|
||||
return [...new Set([packageName, hyphenName, underscoreName, dotName])];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue