Back an `options` object by defaults, and convert some convenience features.

@param {String} type
@param {Object} options
@return {Object} [description]
498155
function clean(type, options) {
  options = assign({}, defaults, options);
  if (type === 'dblclick') {
    options.detail = 2;
  }
  if (isString(options.key)) {
    options.key = keycode(options.key);
  }
  return options;
}
1159214
function options(defaults, opts) {
  for (var p in opts) {
    if (opts[p] && opts[p].constructor && opts[p].constructor === Object) {
      defaults[p] = defaults[p] || {};
      options(defaults[p], opts[p]);
    } else {
      defaults[p] = opts[p];
    }
  }
  return defaults;
}
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;
  }
926278
function checkType(type, key, value, options) {
  options = options || {};

  if (value != undefined) {
    if (options.isArray)
      return checkArray(type, key, value);

    var checker = checkType[type];
    if (checker) return checker(key, value);

    console.warn("Could not check " + key + ", unknown type " + type);
    //    throw TypeError("Could not check "+key+", unknown type "+type);
  } else if (options.required)
    throw SyntaxError(key + " param is required");

}
777619
function(type) {
		//define if put type is present in config
		if (config.moduleTypes.indexOf(type) > -1) {
            config.moduleType = type;
            fs.writeFile(path.resolve(__dirname, 'config.json'), JSON.stringify(config, null, 4), 'utf8', function (err) {
                if (err) {
                    return console.log(err);
                }
            });
		} else {
			return console.log('Wrong type, available types: %j', config.moduleTypes);
		}
	}
434477
def config_default(option, default=None, type=None, section=cli.name):
    
    def f(option=option, default=default, type=type, section=section):
        config = read_config()
        if type is None and default is not None:
            # detect type from default.
            type = builtins.type(default)
        get_option = option_getter(type)
        try:
            return get_option(config, section, option)
        except (NoOptionError, NoSectionError):
            return default
    return f
1213027
function(prop) {
    var opt = this.option(prop);
    if (typeof opt === 'undefined') {
      return this.app && this.app.option ? this.app.option(prop) : null;
    }
    return opt;
  }
716411
function __serializeType(type, options) {
	let typeHeader = (type) ? TYPE_HEADER[type.toUpperCase()] : [];
	let typeData = new Uint8Array(typeHeader);
	return typeData.buffer;
}
525628
function createPrototype (type, options) {
    return new DuckType({
      name: options && options.name || null,
      test: function test (object) {
        return (object instanceof type);
      }
    });
  }
542964
function (type, item) {
        switch(type) {
            case simpleTypes.undefined:
            case simpleTypes.null:
                return true;
            case simpleTypes.string:
                if (item.trim().length === 0) {
                    return true;
                }
                return false;
            case simpleTypes.object:
                return (Object.keys(item).length === 0);
            case simpleTypes.array:
                return (item.length === 0);
            default:
                return false;
        };
    }
1058054
function normalizeOptions(options) {

    var opts = {};

    if (typeof options === 'string') {
        opts = {
            url: options
        };
    } else if (_.isPlainObject(options)) {
        opts = _.clone(options);
    }

    return opts;
}
978167
function Option(options){
		// options should be an object
		if ( typeof options !== 'object' ) {
			throw new Error('options should be an object');
		}
		
		// All options except value must be provided.
		if ( !options.name || !options.description || !options.type || options.defaultValue === undefined ) {
			throw new Error('name,description, type, and defaultValue required');
		}

		// Set name of option
		this.name = options.name;

		// A description of the setting.
		this.description = options.description;

		// The type of value `this` option can have.
		if ( options.type !== Array && options.type !== Number && options.type !== Boolean &&
			options.type !== String && options.type !== Object ){

			throw new Error('Option type must be Boolean,Number,Function,String, or Object');
		}

		this.type = options.type;

		// Default value as defined by node-jshint
		this.defaultValue = options.defaultValue;

		// Current value takes default value by default.
		this.setValue( options.defaultValue );
	}
892890
function defaultForType (type) {
    var def = {
      boolean: true,
      string: '',
      number: undefined,
      array: []
    }

    return def[type]
  }
1133341
def transfer_options(cls, obj, new_obj, backend=None):
        
        backend = cls.current_backend if backend is None else backend
        type_name = type(new_obj).__name__
        group = type_name if obj.group == type(obj).__name__ else obj.group
        spec = '.'.join([s for s in (type_name, group, obj.label) if s])
        options = []
        for group in Options._option_groups:
            opts = cls.lookup_options(backend, obj, group)
            if opts and opts.kwargs: options.append(Options(group, **opts.kwargs))
        if options:
            StoreOptions.set_options(new_obj, {spec: options}, backend)
215063
function(type)
    {
        switch (type) {
            case WebInspector.Resource.Type.Document:
                return "document";
            case WebInspector.Resource.Type.Stylesheet:
                return "stylesheet";
            case WebInspector.Resource.Type.Image:
                return "image";
            case WebInspector.Resource.Type.Font:
                return "font";
            case WebInspector.Resource.Type.Script:
                return "script";
            case WebInspector.Resource.Type.XHR:
                return "xhr";
            case WebInspector.Resource.Type.WebSocket:
                return "websocket";
            case WebInspector.Resource.Type.Other:
            default:
                return "other";
        }
    }
98291
def translate_type(type_info, options)
    if type_info
      klass = plugin_class(type_info[:namespace], type_info[:type])
      logger.debug("Executing option translation for: #{klass.inspect}")

      options = klass.send(:translate, options) if klass.respond_to?(:translate)
    end
    options
  end
267173
function(type)
    {
        switch (type) {
            case this.Document:
                return "document";
            case this.Stylesheet:
                return "stylesheet";
            case this.Image:
                return "image";
            case this.Font:
                return "font";
            case this.Script:
                return "script";
            case this.XHR:
                return "xhr";
            case this.WebSocket:
                return "websocket";
            case this.Other:
            default:
                return "other";
        }
    }