Skip to content

Commit

Permalink
feat: allow direct extraction of the squatted package
Browse files Browse the repository at this point in the history
  • Loading branch information
LawnGnome committed Oct 13, 2023
1 parent a6cb690 commit 1ccfa00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/checks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ impl Squat {
package: package.into(),
}
}

/// Retrieves the name of the package that may be squatted.
pub fn package(&self) -> &str {
match self {
Squat::Bitflip(package) => package,
Squat::OmittedCharacter(package) => package,
Squat::RepeatedCharacter(package) => package,
Squat::SwappedCharacters(package) => package,
Squat::SwappedWords(package) => package,
Squat::Typo(package) => package,
Squat::Version(package) => package,
Squat::Custom {
message: _message,
package,
} => package,
}
}
}

impl Display for Squat {
Expand Down

0 comments on commit 1ccfa00

Please sign in to comment.