diff --git a/.gitignore b/.gitignore index 89b6978..0a75e53 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ JSONWebToken.xcodeproj/xcuserdata + +# User specific settings of XCode +xcuserdata/ + +# macOS specific +.DS_Store diff --git a/JSONWebToken/ClaimValidator.swift b/JSONWebToken/ClaimValidator.swift index f2de023..eeb57ba 100644 --- a/JSONWebToken/ClaimValidator.swift +++ b/JSONWebToken/ClaimValidator.swift @@ -30,6 +30,13 @@ public func ClaimTransformNumber(_ value : Any) throws -> NSNumber { throw ClaimValidatorError(message: "\(value) is not a Number type value") } } +public func ClaimTransformBool(_ value : Any) throws -> Bool { + if let boolValue = value as? Bool { + return boolValue + } else { + throw ClaimValidatorError(message: "\(value) is not a Bool type value") + } +} public func ClaimTransformArray(_ elementTransform : (Any) throws -> U, value : Any) throws -> [U] { if let array = value as? NSArray { return try array.map(elementTransform)