classafBson::Code

sys::Obj
  afBson::Code

@Serializable

(BSON Type) - Wraps a JavaScript function and default variable values.

scope values are automatically evaluated in the context of the code when it is executed. Example:

Code("function (x) { return x + y; }", ["y":2])

Code objects let you re-use functions and change their parameters without re-interpolating a Str function.

Note: Code is not const because the scope document could contain Binary data. Besides, it is advantageous to change the scope / variable values.

code

Source

Str code

JavaScript code.

makeCode

Source

new makeCode(Str code, Str:Obj? scope := [Str:Obj?][:])

Creates a BSON Code instance.

scope

Source

Str:Obj? scope

Default variable values to use in the function code.