We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 35b0e95 + 084f516 commit 586c395Copy full SHA for 586c395
2 files changed
Sources/JSEN.swift
@@ -31,6 +31,7 @@ public enum JSEN : Equatable {
31
case let dictionary as [String:Any]:
32
let jsenElements: [String:JSEN] = dictionary.compactMapValues { JSEN(from: $0) }
33
self = .dictionary(jsenElements)
34
+ case let jsen as JSEN: self = jsen
35
default: return nil
36
}
37
Tests/JSENTests.swift
@@ -61,6 +61,8 @@ final class JSENTests : XCTestCase {
61
XCTAssertEqual(JSEN(from: array), .array([42]))
62
let dictionary: Any? = [ "key" : 42 ]
63
XCTAssertEqual(JSEN(from: dictionary), .dictionary(["key" : 42]))
64
+ let jsen: Any? = JSEN.int(42)
65
+ XCTAssertEqual(JSEN(from: jsen), .int(42))
66
67
68
func test_initializer_withNestedValues_shouldSucceed() {
0 commit comments