Introduce utility methods to test for unknowns and OTP keywords

This commit is contained in:
Danny Moesch 2018-12-08 00:56:22 +01:00 committed by Bob Sun
parent bb6e44950f
commit 68dd60fb8e
3 changed files with 25 additions and 3 deletions

View file

@ -49,7 +49,15 @@ public struct Constants {
public static func isOtpRelated(line: String) -> Bool {
let (key, _) = Parser.getKeyValuePair(from: line)
return OTP_KEYWORDS.contains(key ?? "")
return key != nil && isOtpKeyword(key!)
}
static func isOtpKeyword(_ keyword: String) -> Bool {
return OTP_KEYWORDS.contains(keyword.lowercased())
}
static func isUnknown(_ string: String) -> Bool {
return string.starts(with: UNKNOWN)
}
static func unknown(_ number: UInt) -> String {