code: def _build_js(inputs, outputs, name, implementation, support_code):
      
      # Construct a comma-separated list of input field names
      # For example, field1,field2,...
      input_fields = json.dumps([f[0] for f in inputs])
  
      # Construct a json representation of the output schema
      # For example, [{'name':'field1','type':'string'},...]
      output_fields = [{'name': f[0], 'type': f[1]} for f in outputs]
      output_fields = json.dumps(output_fields, sort_keys=True)
  
      # Build the JS from the individual bits with proper escaping of the implementation
      if support_code is None:
        support_code = ''
      return ('{code}\n{name}={implementation};\nbigquery.defineFunction(\'{name}\', {inputs}, '
              '{outputs}, {name});').format(code=support_code, name=name,
                                            implementation=implementation, inputs=str(input_fields),
                                            outputs=str(output_fields))
docs: Creates a BigQuery SQL UDF javascript object.
  
      Args:
        inputs: a list of (name, type) tuples representing the schema of input.
        outputs: a list of (name, type) tuples representing the schema of the output.
        name: the name of the function
        implementation: a javascript function defining the UDF logic.
        support_code: additional javascript code that the function can use.