applyGateFields
Check and normalize gates and gate_fillers in a function’s fields, in place.
fields is a function definition or the extra fields of one. Its gates become
the plain objects the platform reads, as returned by
gateDefinitions(). A gate_fillers that is left out or
null is removed, because the platform ignores it.
Parameters
fields
The function definition or its extra fields. Modified in place.
functionName
The function’s name, used in error messages and checked against the reserved function names.
opts
Optional settings.
opts.definition
Set to true when fields is a whole function definition sent as written, such
as a DataMap’s or a raw one. Then the gates and gate_fillers keys are found
without regard to case, gates: null is refused, and a gated function needs a
description (or purpose). When false, a null or undefined gates means
no gates, as an option left out does.
Returns
void
Throws Error for gates the platform would refuse, for gate_fillers on a
function without gates (the platform ignores them there), for gate_fillers that
isn’t an object mapping a language code, 'auto', or 'default' to a list of
phrases, and, with definition: true, for a gated definition without a
description.