Convert ruby_options to jsOptions
779284
def convert_options(opts)
      converted = {}

      opts.each_pair do |name, value|
        if /_/ =~ name
          name = name.to_s.gsub(/_\w/) { |i| i.delete("_").upcase }.to_sym
        end
        value = convert_options(value) if value.is_a? Hash
        converted[name] = value
      end

      converted
    end
590366
def as_json(options=nil)
      actions = []
      indices.add_indices.each do |index|
        operation = { :index => index, :alias => name }
        operation.update( { :routing => routing } ) if respond_to?(:routing) and routing
        operation.update( { :filter  => filter } )  if respond_to?(:filter)  and filter
        actions.push( { :add => operation } )
      end

      indices.remove_indices.each do |index|
        operation = { :index => index, :alias => name }
        actions.push( { :remove => operation } )
      end

      { :actions => actions }
    end
194752
def app_options
      if ambiguous?
        hash = {}
        @global_options.each_with_index do |option, i|
          hash[i] = option['name'] || option['root']
        end
        hash
      else
        {}
      end
    end
958259
function parseOptions(opts) {
  opts = opts || {};
  var argv = [];
  var options = {};
  var process_argv = process.argv;
  for (var i = 2; i < process_argv.length; i++) {
    if (process_argv[i].indexOf('--') == 0) {
      var arg = process_argv[i];
      if (arg.indexOf("=") > 0) {
        var arg_kv = arg.split('=');
        arg = arg_kv[0];
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = arg_kv[1];
        if (typeof opts[arg] == 'string') {
          if (opts[arg] == 'int' || opts[arg] == 'integer') {
            options[arg] = parseInt(options[arg]);
          } else if (opts[arg] == 'float') {
            options[arg] = parseFloat(options[arg]);
          }
        } else if (typeof opts[arg] == 'object') {
          if (opts[arg].type == 'array') {
            var sep = opts[arg].separator || opts[arg].sep || ',';
            options[arg] = options[arg].split(sep);
          }
        }
      } else {
        arg = arg.replace('--','');
        arg = replaceAll(arg, '-', '_');
        options[arg] = true;
      }
    } else {
      argv.push(process_argv[i]);
    }
  }
  options.argv = argv;
  return options;
}
998023
def renderer_options
      options = {
        # script_name: "", # unfortunately doesnt seem to effect relative_url_root like desired
        # input: ""
      }

      origin = headers["origin"]
      if origin
        uri = URI.parse(origin)
        options[:https] = uri.scheme == "https"
      end

      # Important to not use rack_headers as local variable instead of headers.
      # headers is a method that gets deleted to controller.headers and using it
      # seems to cause issues.
      rack_headers = rackify_headers(headers)
      options.merge!(rack_headers)

      # Note @options[:method] uses @options vs options on purpose
      @options[:method] = event["httpMethod"].downcase if event["httpMethod"]
      options
    end
152097
function createOptions( options ) {
	var object = optionsCache[ options ] = {};
	jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
		object[ flag ] = true;
	});
	return object;
}
1311074
def as_json(options = {})
      {}.tap do |result|
        result[:body] = @body unless @body.nil?
        result[:headers] = @headers unless @headers.nil?
        result[:status] = @status unless @status.nil?
      end
    end
726551
def as_json(options = { })
      flex_column_names = self.class._all_flex_column_names
      out = super(:except => flex_column_names)

      flex_columns_hash = { }
      flex_column_names.each do |column_name|
        hash = _flex_column_object_for(column_name).to_hash_for_serialization
        flex_columns_hash[column_name] = hash unless hash.empty?
      end

      if include_root_in_json && out.keys.length == 1
        out[out.keys.first].merge!(flex_columns_hash)
      else
        out.merge!(flex_columns_hash)
      end

      out
    end
231772
def as_json(options = nil) #:nodoc:
            # use encoder as a proxy to call as_json on all elements, to protect from circular references
            encoder = options && options[:encoder] || ActiveSupport::JSON::Encoding::Encoder.new(options)
            map { |v| encoder.as_json(v) }
        end
437217
def extract_options!(options, html_options: nil)
      options.symbolize_keys!
      html_options.symbolize_keys! if html_options

      # effective_bootstrap specific options
      layout = options.delete(:layout) # Symbol
      wrapper = options.delete(:wrapper) # Hash
      input_group = { append: options.delete(:append), prepend: options.delete(:prepend), input_group: options.delete(:input_group) }.compact

      feedback = options.delete(:feedback) # Hash
      label = options.delete(:label) # String or Hash
      hint = options.delete(:hint) # String or Hash

      input_html = options.delete(:input_html) || {} # Hash
      input_js = options.delete(:input_js) || {} # Hash

      # Every other option goes to input
      @options = input = (html_options || options)

      # Merge all the default objects, and intialize everything
      wrapper = merge_defaults!(wrapper, wrapper_options)
      input_group = merge_defaults!(input_group, input_group_options)
      feedback = merge_defaults!(feedback, feedback_options)

      label = merge_defaults!(label, label_options)
      hint = merge_defaults!(hint, hint_options)

      merge_defaults!(input.merge!(input_html), input_html_options)
      merge_defaults!(input_js, input_js_options)

      if input_js.present?
        merge_defaults!(input_js, input_js_options_method_name)
        input['data-input-js-options'] = JSON.generate(input_js)
      end

      { layout: layout, wrapper: wrapper, input_group: input_group, label: label, hint: hint, input: input, feedback: feedback }
    end
396828
def parse_options
      @options = {
        :config_paths    => Jammit::DEFAULT_CONFIG_PATH,
        :output_folder  => nil,
        :base_url       => nil,
        :force          => false
      }
      @option_parser = OptionParser.new do |opts|
        opts.on('-o', '--output PATH', 'output folder for packages (default: "public/assets")') do |output_folder|
          @options[:output_folder] = output_folder
        end
        opts.on('-c', '--config PATH', 'path to assets.yml (default: "config/assets.yml")') do |config_path|
          @options[:config_paths] = config_path
        end
        opts.on('-u', '--base-url URL', 'base URL for MHTML (ex: "http://example.com")') do |base_url|
          @options[:base_url] = base_url
        end
        opts.on('-f', '--force', 'force a rebuild of all assets') do |force|
          @options[:force] = force
        end
        opts.on('-p', '--packages LIST', 'list of packages to build (ex: "core,ui", default: all)') do |package_names|
          @options[:package_names] = package_names.split(/,\s*/).map {|n| n.to_sym }
        end
        opts.on('-P', '--public-root PATH', 'path to public assets (default: "public")') do |public_root|
          puts "Option for PUBLIC_ROOT"
          @options[:public_root] = public_root
        end
        opts.on_tail('-v', '--version', 'display Jammit version') do
          puts "Jammit version #{Jammit::VERSION}"
          exit
        end
      end
      @option_parser.banner = BANNER
      @option_parser.parse!(ARGV)
    end
207957
function parseOptions(options) {

  ttl = options.ttl || (3600 * 24); // cache for 1 day by default.
  tmpCacheTTL = options.tmpCacheTTL || 5; // small by default
  decodeFn = options.decodeFn || exports.decodeURL;
  presets  = options.presets || defaultPresets();

  tmpDir   = options.tmpDir || '/tmp/nodethumbnails';

  var rootPath = options.rootPath || '/thumbs';
  if (rootPath[0] === '/') { rootPath = rootPath.substring(1); } // be forgiving to user errors!

  var allowedExtensions = options.allowedExtensions || ['gif', 'png', 'jpg', 'jpeg'];
  for (var i=0; i < allowedExtensions.length; i++) {
    // be forgiving to user errors!
    if (allowedExtensions[i][0] === '.') {
      allowedExtensions[i] = allowedExtensions[i].substring(1);
    }
  }
  var szExtensions = allowedExtensions.join('|');

  // Example: http://example.com/thumbs/small/images/AB23DC16Hash.jpg
  regexp = new RegExp('^\/' + rootPath.replace(/\//ig, '\\/') +
    '\/([A-Za-z0-9_]+)\/images\/([%\.\-A-Za-z0-9_=\+]+)\.(?:' + szExtensions + ')$', 'i');
}
1296068
def parse_options options = {}, request = ''
      options.each do |opt, value|
        case opt
        when :timeout, :paging, :mode
          request += "&#{opt}=#{value}"
        when :callback, :stats
          request += "&#{opt}"
        when :fields
          request += "&#{opt}=" + value.join(',') if value.is_a?(Array)
        end
      end
      request
    end
807341
function getOptions (userOptions = {}) {
	let options = _.cloneDeep(userOptions);

	if (options.format === 'html') {
		options.outputAsHtml = true;
		options.verbose = true;
		options.format = 'json';
	}

	return options;
}
451087
def options=(options)
      fail ArgumentError, 'options must be a Hash. ' \
                          "#{ options.inspect } given." unless options.is_a?(Hash)

      @options.merge! options

      build_query
    end
426676
def _normalize_options(options)
        _normalize_text(options)

        if options[:html]
          options[:html] = ERB::Util.html_escape(options[:html])
        end

        if options[:status]
          options[:status] = Rack::Utils.status_code(options[:status])
        end

        super
      end
322139
def options_hash_to_string(options)
      result = ''
      options.sort_by { |key, _| OPTION_ORDER.find_index(key) || -1 }.each do |key, value|
        if value
          result += "set #{OptionHandling.option_to_string(key, value)}\n"
        else
          result += "unset #{key}\n"
        end
      end
      result
    end