JavaScriptKit Documentation Beta

Class JSValue​Decoder

public class JSValueDecoder

JSValueDecoder facilitates the decoding of JavaScript value into semantic Decodable types.

Initializers

init()

public init()

Initializes a new JSValueDecoder.

Methods

decode(_:​from:​user​Info:​)

public func decode<T>(_: T.Type = T.self, from value: JSValue, userInfo: [CodingUserInfoKey: Any] = [:]) throws -> T where T: Decodable

Decodes a top-level value of the given type from the given JavaScript value representation.

Parameters

T

The type of the value to decode.

value JSValue

The JSValue to decode from.