@@ -77,7 +77,8 @@ extension JSObject: JSValueCodable {
77
77
// from `JSFunction`
78
78
}
79
79
80
- private let Object = JSObject . global. Object. function!
80
+ private let objectConstructor = JSObject . global. Object. function!
81
+ private let arrayConstructor = JSObject . global. Array. function!
81
82
82
83
extension Dictionary where Value: JSValueConvertible , Key == String {
83
84
public func jsValue( ) -> JSValue {
@@ -87,20 +88,19 @@ extension Dictionary where Value: JSValueConvertible, Key == String {
87
88
88
89
extension Dictionary : JSValueConvertible where Value == JSValueConvertible , Key == String {
89
90
public func jsValue( ) -> JSValue {
90
- let object = Object . new ( )
91
+ let object = objectConstructor . new ( )
91
92
for (key, value) in self {
92
93
object [ key] = value. jsValue ( )
93
94
}
94
95
return . object( object)
95
96
}
96
97
}
97
98
98
- private let NativeJSArray = JSObject . global. Array. function!
99
99
extension Dictionary : JSValueConstructible where Value: JSValueConstructible , Key == String {
100
100
public static func construct( from value: JSValue ) -> Self ? {
101
101
guard
102
102
let objectRef = value. object,
103
- let keys: [ String ] = Object . keys!( objectRef. jsValue ( ) ) . fromJSValue ( )
103
+ let keys: [ String ] = objectConstructor . keys!( objectRef. jsValue ( ) ) . fromJSValue ( )
104
104
else { return nil }
105
105
106
106
var entries = [ ( String, Value) ] ( )
@@ -143,7 +143,7 @@ extension Array where Element: JSValueConvertible {
143
143
144
144
extension Array : JSValueConvertible where Element == JSValueConvertible {
145
145
public func jsValue( ) -> JSValue {
146
- let array = NativeJSArray . new ( count)
146
+ let array = arrayConstructor . new ( count)
147
147
for (index, element) in enumerated ( ) {
148
148
array [ index] = element. jsValue ( )
149
149
}
0 commit comments