Skip to content

Commit

Permalink
fix: handle Int32 and Int64 in defaultValue evaluations
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklasl committed Jul 10, 2024
1 parent 409974d commit b96f410
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/Confidence/FlagEvaluation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ extension FlagResolution {
case .string:
return value.asString() as? T
case .integer:
return value.asInteger() as? T
if let intValue = value.asInteger() as? T {
return intValue
}
if T.self == Int32.self, let intValue = value.asInteger() {
return Int32(intValue) as? T
}
if T.self == Int64.self, let intValue = value.asInteger() {
return Int64(intValue) as? T
}
return nil
case .double:
return value.asDouble() as? T
case .date:
Expand Down

0 comments on commit b96f410

Please sign in to comment.