Populates +opts+ for reaction server with defaults.
 @param [Hash] opts          hash of options
 @return [Hash] defaultized options
503413
def use_reaction_defaults(opts)
      defaults = {
        at: 'http://localhost:9292/reaction',
        key: Rails.application.config.secret_token
      }
      opts = defaults.merge opts
    end
1171110
function (opts) {
    // prepare properties
    this.actionQueue = [];
    this.config = opts.config;
    this.lastCalledUrl = null;
    this.driverStatus = {};
    this.sessionStatus = {};
    // store injcted options in object properties
    this.events = opts.events;
    this.reporterEvents = opts.reporter;
    this.browserName = opts.browser;
    return this;
  }
1054054
function opt(options, name, defaultValue){
    return options && options[name]!==undefined ? options[name] : defaultValue;
}
526889
def prepare_options(opts = [])
      opts.inject('') do |string, (option, value)|
        string += case
                  when value
                    create_option(option, value)
                  when option.respond_to?(:each_pair)
                    prepare_options(option)
                  else
                    create_option(option)
                  end
      end
    end
283145
def set_options(opts)
      opts.version, opts.banner = options.version, options.banner
      opts.set_program_name 'LinkShrink'

      options.api.map do |k, v|
        arg = k.to_s.downcase

        opts.on_head("-#{arg[0]}", "--#{arg}", argument_text_for(k)) do
          options.api[k] = true
        end
      end

      opts.on_tail('-v', '--version',
                   'display the version of LinkShrink and exit') do
        puts opts.ver
        exit
      end

      opts.on_tail('-h', '--help', 'print this help') do
        puts opts.help
        exit
      end
    end
715440
function createReqIdHeaders(opts) {

    assert.object(opts, 'opts');
    assert.arrayOfString(opts.headers, 'opts.headers');

    var headers = opts.headers.concat(DEFAULT_HEADERS);

    return function reqIdHeaders(req, res, next) {

        for (var i = 0; i < headers.length; i++) {
            var val = req.header(headers[i]);

            if (val) {
                req.id(val);
                break;
            }
        }

        return next();
    };
}
1314086
def option(opts, *args)
      long_opt_symbol = long_opt_symbol(args)
      args += Array(OptionsHelp::TEXT[long_opt_symbol])
      opts.on(*args) do |arg|
        @options[long_opt_symbol] = arg
        yield arg if block_given?
      end
    end
10122
def parse_opts(opts_in, opts_defaults)
      diff_id = opts_in.keys - opts_defaults.keys
      raise ArgumentError, "Unrecognised argument(s): #{diff_id.join(", ")}" if diff_id.any?

      (opts_in.keys & opts_defaults.keys).each do |k|
        raise ArgumentError, "Argument #{k.to_s} must not be nil" if opts_defaults[k] == nil and opts_in[k] == nil
      end

      (opts_defaults.keys - opts_in.keys).each do |k|
        raise ArgumentError, "Argument #{k.to_s} must not be nil" if opts_defaults[k] == nil
        opts_in.merge!(k => opts_defaults[k])
      end
      opts_in
    end
21226
function defaults(options) {
  options || (options = {});
  options.apiKey || (options.apiKey = 'YOUR_API_KEY');
  options.host || (options.host = 'cdn.segment.com');
  if (!has.call(options, 'page')) options.page = true;
  if (!has.call(options, 'load')) options.load = true;
  return options;
}
598680
function (opts) {
    this.options = opts || {};
    this.pattern = null;
    this.middleware = {};
    this.includes = {};
    this.excludes = {};
    this.files = [];
    this.fns = [];

    options(this);
    iterators(this);
    symlinks(this);
    readers(this);
  }
410969
function(opt){
        // merge with default options
        Object.keys(_options).forEach(function(key){
            _options[key] = opt[key] || _options[key];
        });
    }
344894
function makeArrayOpt(opts, name) {
    if( !Array.isArray(opts[name]) ) {
      opts[name] = [ opts[name] ];
    }
    return opts[name];
  }
566937
function createOptionsObject(target, opts) {
  let defaults = {
    boundingBox : {
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      w: 3,
      h: 3,
    },
    renderedDimensions : () => ({w: 3, h: 3}),
    redneredPosition : () => ({x : 0, y : 0}),
    popper : {},
    cy : target
  };

  return assign( {}, defaults, opts );
}
1226149
def process_options(opts, config)
      options.each do |option|
        opts.on(*option.for_option_parser) do |x|
          config[map[option]] = x
        end
      end
    end
571564
def with(opts)
      new_options =
        if opts.key?(:meta)
          opts.merge(meta: meta.merge(opts[:meta]))
        else
          opts
        end

      new(dataset, options.merge(new_options))
    end
77668
def with_options(opts = {}) # :nodoc:
      opts = opts.dup
      opts.delete(:comment)
      @opt_stack.push( @opt_stack.last.merge(opts))
      yield self
      @opt_stack.pop
    end
1325740
protected function loadCliOptions(array $opts)
    {
        $map = [
            'c' => 'conf_file',   // config file
            's' => 'servers', // server address

            'n' => 'workerNum',  // worker number do all tasks
            'u' => 'user',
            'g' => 'group',

            'l' => 'logFile',
            'p' => 'pidFile',

            'r' => 'maxRunTasks', // max run tasks for a worker
            'x' => 'maxLifetime',// max lifetime for a worker
            't' => 'timeout',
        ];

        // show help
        if (isset($opts['h']) || isset($opts['help'])) {
            $this->showHelp();
        }
        // show version
        if (isset($opts['V']) || isset($opts['version'])) {
            $this->showVersion();
        }

        // load opts values to config
        foreach ($map as $k => $v) {
            if (isset($opts[$k]) && $opts[$k]) {
                $this->config[$v] = $opts[$k];
            }
        }

        // load Custom Config File
        if ($file = $this->config['conf_file']) {
            if (!file_exists($file)) {
                $this->showHelp("Custom config file {$file} not found.");
            }

            $config = require $file;
            $this->setConfig($config);
        }

        // watch modify
        if (isset($opts['w']) || isset($opts['watch'])) {
            $this->config['watch_modify'] = $opts['w'];
        }

        // run as daemon
        if (isset($opts['d']) || isset($opts['daemon'])) {
            $this->config['daemon'] = true;
        }

        // no test
        if (isset($opts['no-test'])) {
            $this->config['no_test'] = true;
        }

        // only added tasks
        if (isset($opts['tasks']) && ($added = trim($opts['tasks'], ','))) {
            $this->config['added_tasks'] = strpos($added, ',') ? explode(',', $added) : [$added];
        }

        if (isset($opts['v'])) {
            $opts['v'] = $opts['v'] === true ? '' : $opts['v'];

            switch ($opts['v']) {
                case '':
                    $this->config['logLevel'] = self::LOG_INFO;
                    break;
                case 'v':
                    $this->config['logLevel'] = self::LOG_PROC_INFO;
                    break;
                case 'vv':
                    $this->config['logLevel'] = self::LOG_WORKER_INFO;
                    break;
                case 'vvv':
                    $this->config['logLevel'] = self::LOG_DEBUG;
                    break;
                case 'vvvv':
                    $this->config['logLevel'] = self::LOG_CRAZY;
                    break;
                default:
                    // $this->config['logLevel'] = self::LOG_INFO;
                    break;
            }
        }
    }