From bdd2ad946b1e9a5cc627b18e157433cf4ee4a7ad Mon Sep 17 00:00:00 2001 From: Brian Michel Date: Tue, 28 Nov 2023 22:01:03 -0500 Subject: [PATCH] Remove CoreFoundat imports These are non-portable outside of the Darwin set of platforms, and seem unneeded to build the library. --- Sources/JSONSafeEncoder/JSONError.swift | 1 - Sources/JSONSafeEncoder/JSONSafeEncoder.swift | 7 +++---- Sources/JSONSafeEncoder/JSONValue.swift | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Sources/JSONSafeEncoder/JSONError.swift b/Sources/JSONSafeEncoder/JSONError.swift index f6b190c..7923758 100644 --- a/Sources/JSONSafeEncoder/JSONError.swift +++ b/Sources/JSONSafeEncoder/JSONError.swift @@ -19,7 +19,6 @@ Copyright (c) 2023 Twilio Inc. import Foundation -import CoreFoundation enum JSONError: Swift.Error, Equatable { case cannotConvertInputDataToUTF8 diff --git a/Sources/JSONSafeEncoder/JSONSafeEncoder.swift b/Sources/JSONSafeEncoder/JSONSafeEncoder.swift index e328f57..16b8273 100644 --- a/Sources/JSONSafeEncoder/JSONSafeEncoder.swift +++ b/Sources/JSONSafeEncoder/JSONSafeEncoder.swift @@ -18,7 +18,6 @@ Copyright (c) 2023 Twilio Inc. ---------------------------------------------------------------------------------------------**/ import Foundation -import CoreFoundation /// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary` /// containing `Encodable` values (in which case it should be exempt from key conversion strategies). @@ -102,16 +101,16 @@ open class JSONSafeEncoder { public enum NonConformingFloatEncodingStrategy { /// Throw upon encountering non-conforming values. This is the default strategy. case `throw` - + /// Set the value to null, like Javascript does. case `null` - + /// Set the value to zero, the safest option for Swift decoding. case zero /// Encode the values using the given representation strings. case convertToString(positiveInfinity: String, negativeInfinity: String, nan: String) - + /// Default strings, similar to Python static var convertToStringDefaults = NonConformingFloatEncodingStrategy.convertToString( positiveInfinity: "Infinity", diff --git a/Sources/JSONSafeEncoder/JSONValue.swift b/Sources/JSONSafeEncoder/JSONValue.swift index 1e89ccd..bc8157a 100644 --- a/Sources/JSONSafeEncoder/JSONValue.swift +++ b/Sources/JSONSafeEncoder/JSONValue.swift @@ -18,7 +18,6 @@ Copyright (c) 2023 Twilio Inc. ---------------------------------------------------------------------------------------------**/ import Foundation -import CoreFoundation internal enum JSONValue: Equatable { case string(String) @@ -39,7 +38,7 @@ extension JSONValue { return true } } - + var isContainer: Bool { switch self { case .array, .object: @@ -101,4 +100,3 @@ private extension JSONValue { } } } -