Setting value of a key to nil in opts_defaults forces non-nil value of key in opts_in
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
869962
function opt(argv, arg, index, key) {
    var value = argv[index + 1], equals = arg.indexOf('=');
    if(equals > -1) {
      value = arg.substr(equals + 1);
    }
    if(value && ~keys.indexOf(value)) {
      return value;
    }
    if(arg === option[key]) {
      return modes[key];
    }
  }
1282034
def set(key, value = nil)
      if key.is_a?(Hash)
        properties.merge!(key)
      else
        properties[key] = value
      end
    end
754751
def set_pandoc_ruby_options(flag, argument = nil)
      case flag
      when 't', 'to'
        @writer = argument.to_s
        @binary_output = true if BINARY_WRITERS.keys.include?(@writer)
      end
    end
975384
function(key, value) {
    switch (utils.typeOf(key)) {
      case 'object':
        this.visit('option', key);
        break;
      case 'array':
      case 'string':
        if (typeof value === 'undefined') {
          return this.either(key, utils.get(this.defaults, key));
        }
        this.emit('option', key, value);
        utils.set(this.options, key, value);
        break;
      default: {
        throw new TypeError('expected key to be a string, object or array');
      }
    }
    return this;
  }
871207
def set_default_option(cls, key, value):
        """"""
        cls._default_options.update(cls._option_schema({key: value}))
1341558
def set_defaults(object, filter = method(:skip_default?))
      each do |attribute|
        next if filter.call(object, attribute)
        attribute.set_default_value(object)
      end
    end
410219
def skip_conversion?(obj, attr, value)
      value.nil? || !obj.class.attributes.key?(attr)
    end
352490
def opts(**kws)
      res = {}
      kws.each_pair do |kw, v|
        res[kw] = v[0] unless v[0] == v[1]
      end
      res
    end
303732
def option(name, type = nil, **opts, &block)
      add_definition(true, name, type, block, opts)
    end
917220
def prefer_non_nil_variables pins
      result = []
      nil_pins = []
      pins.each do |pin|
        if pin.variable? && pin.nil_assignment?
          nil_pins.push pin
        else
          result.push pin
        end
      end
      result + nil_pins
    end
1064088
function (name, opts) {
            var self = this;
            if (typeof name === 'string') {
                if (self.hasAttr(name)) {
                    // if attribute does not have default value, then set to undefined
                    return self.set(name, getDefAttrVal(self, name), opts);
                } else {
                    return self;
                }
            }
            opts = /**@type Object
         @ignore*/
            name;
            var attrs = self.getAttrs(), values = {};    // reset all
            // reset all
            for (name in attrs) {
                values[name] = getDefAttrVal(self, name);
            }
            self.set(values, opts);
            return self;
        }
1173440
function setOptName(opt, optKey) {
    var key$ = optKey + '$';
    opts[key$] = opts[key$] || {};
    var name = opt.name || fspath.basename(opt.path);
    while (opts[key$][name]) {
      name = '_' + name;
    }
    opts[key$][name] = opt;
    opt.name = name;
  }
383066
def parse_opts(opts)
      REQUIRED_OPTS.each do |opt|
        raise "#{opt.inspect} option not provided" if opts[opt].nil?
      end

      rafka_opts = opts.reject { |k| k == :redis || k == :librdkafka }

      redis_opts = REDIS_DEFAULTS.dup.merge(opts[:redis] || {})
      redis_opts.merge!(
        rafka_opts.select { |k| [:host, :port, :id].include?(k) }
      )

      [rafka_opts, redis_opts]
    end
968069
def config_arg(arguments, key, default = nil)
      value = if arguments[key].present?
        arguments[key]
      else
        configuration[key]
      end

      value = value.to_s if value.kind_of? Symbol

      return value
    end
911277
def []=(key, val)
      supported_option?(key) || raise(UnsupportedOptionError, key.inspect)
      values[key] = val
    end
1264333
function defaultOptions(opts) {
    opts.bucketSize = opts.bucketSize || 20;
    opts.concurrency = opts.concurrency || 3;
    opts.expireTime = opts.expireTime || 60 * 60 * 24;
    opts.refreshTime = opts.refreshTime || 60 * 60;
    opts.replicateTime = opts.replicateTime || 60 * 60;
    opts.republishTime = opts.republishTime || 60 * 60 * 24;
}