Skip to content

Remove CoreFoundation Imports #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Sources/JSONSafeEncoder/JSONError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Copyright (c) 2023 Twilio Inc.


import Foundation
import CoreFoundation

enum JSONError: Swift.Error, Equatable {
case cannotConvertInputDataToUTF8
Expand Down
7 changes: 3 additions & 4 deletions Sources/JSONSafeEncoder/JSONSafeEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions Sources/JSONSafeEncoder/JSONValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Copyright (c) 2023 Twilio Inc.
---------------------------------------------------------------------------------------------**/

import Foundation
import CoreFoundation

internal enum JSONValue: Equatable {
case string(String)
Expand All @@ -39,7 +38,7 @@ extension JSONValue {
return true
}
}

var isContainer: Bool {
switch self {
case .array, .object:
Expand Down Expand Up @@ -101,4 +100,3 @@ private extension JSONValue {
}
}
}