Skip to content

Commit 7df821b

Browse files
committed
Remove unused Value.from constructor
1 parent 7c9543c commit 7df821b

1 file changed

Lines changed: 0 additions & 90 deletions

File tree

Sources/ToonFormat/Value.swift

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -104,96 +104,6 @@ enum Value: Equatable {
104104
guard let array = arrayValue else { return false }
105105
return array.allSatisfy { $0.isObject }
106106
}
107-
108-
// MARK: - Factory
109-
110-
/// Creates a `Value` from an arbitrary value.
111-
static func from(_ value: Any) -> Value {
112-
if value is NSNull {
113-
return .null
114-
}
115-
116-
if let boolValue = value as? Bool {
117-
return .bool(boolValue)
118-
}
119-
120-
if let intValue = value as? Int {
121-
return .int(Int64(intValue))
122-
}
123-
if let int8Value = value as? Int8 {
124-
return .int(Int64(int8Value))
125-
}
126-
if let int16Value = value as? Int16 {
127-
return .int(Int64(int16Value))
128-
}
129-
if let int32Value = value as? Int32 {
130-
return .int(Int64(int32Value))
131-
}
132-
if let int64Value = value as? Int64 {
133-
return .int(int64Value)
134-
}
135-
136-
if let uintValue = value as? UInt {
137-
return .int(Int64(uintValue))
138-
}
139-
if let uint8Value = value as? UInt8 {
140-
return .int(Int64(uint8Value))
141-
}
142-
if let uint16Value = value as? UInt16 {
143-
return .int(Int64(uint16Value))
144-
}
145-
if let uint32Value = value as? UInt32 {
146-
return .int(Int64(uint32Value))
147-
}
148-
if let uint64Value = value as? UInt64 {
149-
if uint64Value <= Int64.max {
150-
return .int(Int64(uint64Value))
151-
} else {
152-
return .string(String(uint64Value))
153-
}
154-
}
155-
156-
if let floatValue = value as? Float {
157-
return floatValue.isFinite ? .double(Double(floatValue)) : .null
158-
}
159-
if let doubleValue = value as? Double {
160-
return doubleValue.isFinite ? .double(doubleValue) : .null
161-
}
162-
163-
if let stringValue = value as? String {
164-
return .string(stringValue)
165-
}
166-
167-
if let dateValue = value as? Date {
168-
return .date(dateValue)
169-
}
170-
171-
if let urlValue = value as? URL {
172-
return .url(urlValue)
173-
}
174-
175-
if let dataValue = value as? Data {
176-
return .data(dataValue)
177-
}
178-
179-
if let arrayValue = value as? [Any] {
180-
return .array(arrayValue.map(Value.from))
181-
}
182-
183-
if let dictionaryValue = value as? [String: Any] {
184-
var object: [String: Value] = [:]
185-
// Sort keys to ensure deterministic order
186-
let sortedKeys = dictionaryValue.keys.sorted()
187-
188-
for key in sortedKeys {
189-
let value = dictionaryValue[key]!
190-
object[key] = Value.from(value)
191-
}
192-
return .object(object, keyOrder: sortedKeys)
193-
}
194-
195-
return .null
196-
}
197107
}
198108

199109
// MARK: - Coding Key

0 commit comments

Comments
 (0)