toEngine

fun <V> toEngine(value: Any?, scalar: (Any?) -> V, array: (List<V>) -> V, obj: (List<Pair<String, V>>) -> V, bytes: (ByteArray) -> V): V(source)

Builds value in an engine: scalar takes a canonical scalar or a handle and answers the engine's own value, array builds an array from elements already built, obj a plain object from keys and values already built, and bytes a Uint8Array over a copy of bytes. These callbacks cannot build cycles; cyclic input or a depth of 128 throws JsEngineError. Engines use toEngineGraph to preserve graphs without a traversal depth limit.