Skip to content

Commit

Permalink
Added Int32 & Int64 Extensions
Browse files Browse the repository at this point in the history
Added Extensions for Uint32, UInt64, Int32, & Int64 so that those types do not fail when converting to string with jsonEncodedString()


Former-commit-id: 9a46b92
  • Loading branch information
rymcol committed Aug 1, 2016
1 parent 4b32a5b commit 4b27983
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Sources/PerfectLib/JSONConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,34 @@ extension UInt: JSONConvertible {
}
}

extension Int32: JSONConvertible {
/// Convert an Int into JSON text.
public func jsonEncodedString() throws -> String {
return String(self)
}
}

extension Int64: JSONConvertible {
/// Convert an Int into JSON text.
public func jsonEncodedString() throws -> String {
return String(self)
}
}

extension UInt32: JSONConvertible {
/// Convert an Int into JSON text.
public func jsonEncodedString() throws -> String {
return String(self)
}
}

extension UInt64: JSONConvertible {
/// Convert an Int into JSON text.
public func jsonEncodedString() throws -> String {
return String(self)
}
}

extension Double: JSONConvertible {
/// Convert a Double into JSON text.
public func jsonEncodedString() throws -> String {
Expand Down

0 comments on commit 4b27983

Please sign in to comment.