Normalize options.
@param {number|string|undefined} type The type of indentation.
@param {object} options Other options.
@returns {object} Normalized options.
421933
function parseOptions(type, options) {
    const ret = {
        indentChar: " ",
        indentSize: 2,
        attribute: 1,
        closeBracket: 0,
    }

    if (Number.isSafeInteger(type)) {
        ret.indentSize = type
    } else if (type === "tab") {
        ret.indentChar = "\t"
        ret.indentSize = 1
    }
    if (Number.isSafeInteger(options.attribute)) {
        ret.attribute = options.attribute
    }
    if (Number.isSafeInteger(options.closeBracket)) {
        ret.closeBracket = options.closeBracket
    }

    return ret
}
967548
function normalize(options, templates) {
  // Options override defaults and toc methods.
  var result = _.defaults({}, options, toc, toc.defaults);
  // Remove "core" methods from result object.
  ['defaults', 'process', 'anchorize', 'toc'].forEach(function(prop) {
    delete result[prop];
  });
  // Compile Lodash string templates into functions.
  (templates || []).forEach(function(tmpl) {
    if (typeof result[tmpl] === 'string') {
      result[tmpl] = _.template(result[tmpl]);
    }
  });
  return result;
}
547919
function(types, options){
			if(!Array.isArray(types)) {
				return options.inverse(this);
			}
			var typesWithDescriptions = [];
			types.forEach(function( type ){
				if(type.description){
					typesWithDescriptions.push(type)
				}
			});
			
			if( !typesWithDescriptions.length ) {
				// check the 1st one's options
				if(types.length == 1 && types[0].options ) {
					types[0].options.forEach(function(option){
						typesWithDescriptions.push(option);
					});
				}
				
			}
			
			if(typesWithDescriptions.length){
				return options.fn({types: typesWithDescriptions});
			} else {
				return options.inverse(this);
			}
		}
1033940
function normalizeOptions(obj) {
  for (var key in obj) {
    if (utils.optsKeys.indexOf(key) > -1) {
      obj.options = obj.options || {};
      obj.options[key] = obj[key];
      delete obj[key];
    }
  }
  return obj;
}
631514
def _normalize_options(options):
    """"""
    normalized_options = {}
    for key, value in iteritems(options):
        optname = str(key).lower()
        intname = INTERNAL_URI_OPTION_NAME_MAP.get(optname, key)
        normalized_options[intname] = options[key]
    return normalized_options
768668
function(options){
        this.type = options.type || EJS.type;
		this.cache = options.cache != null ? options.cache : EJS.cache;
		this.text = options.text || null;
		this.name =  options.name || null;
		this.ext = options.ext || EJS.ext;
		this.extMatch = new RegExp(this.ext.replace(/\./, '\.'));
	}
34636
def normalize_defaults
      new_options = {}
      options.each do |key,value|
        unless value.nil?
          new_options[key.to_s] = value
          new_options[key.to_sym] = value
        end
      end
      options.merge!(new_options)
    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
86494
protected function normalizeMode($type, $mode)
    {
        $normalizedMode = null;
        
        if (is_int($mode)) {
            $normalizedMode = $mode;
        } elseif (null !== $mode) {
            if (!is_array($mode)) {
                $mode = [$mode];
            }
            
            foreach ($mode as $m) {
                switch ($m) {
                    case 'optional':
                        if ($type == 'option') {
                            $value = InputOption::VALUE_OPTIONAL;
                        } else {
                            $value = InputArgument::OPTIONAL;
                        }
                        if (null === $normalizedMode) {
                            $normalizedMode = $value;
                        } else {
                            $normalizedMode = $normalizedMode | $value;
                        }
                        break;
                    
                    case 'required':
                        if ($type == 'option') {
                            $value = InputOption::VALUE_REQUIRED;
                        } else {
                            $value = InputArgument::REQUIRED;
                        }
                        if (null === $normalizedMode) {
                            $normalizedMode = $value;
                        } else {
                            $normalizedMode = $normalizedMode | $value;
                        }
                        break;
                    
                    case 'array':
                        if ($type == 'option') {
                            $value = InputOption::VALUE_IS_ARRAY;
                        } else {
                            $value = InputArgument::IS_ARRAY;
                        }
                        if (null === $normalizedMode) {
                            $normalizedMode = $value;
                        } else {
                            $normalizedMode = $normalizedMode | $value;
                        }
                        break;
                    
                    case 'none':
                        if ($type == 'option') {
                            if (null === $normalizedMode) {
                                $normalizedMode = InputOption::VALUE_NONE;
                            } else {
                                $normalizedMode = $normalizedMode | InputOption::VALUE_NONE;
                            }
                        }
                        break;
                    
                    default:
                        throw new Exception\InvalidArgumentException(
                            sprintf(
                                "Mode must be either 'none', 'optional', 'required' or 'array', passed '%s'",
                                $m
                            )
                        );
                        break;
                }
            }
        }
        
        return $normalizedMode;
    }
1351576
function normalize(value, options) {
  var settings = options || {}
  var allowApostrophes = settings.allowApostrophes
  var allowDashes = settings.allowDashes
  var result = (typeof value === 'string' ? value : toString(value))
    .toLowerCase()
    .replace(APOSTROPHE, QUOTE)

  if (allowApostrophes && allowDashes) {
    return result
  }

  if (allowApostrophes) {
    return result.replace(DASH, EMPTY)
  }

  if (allowDashes) {
    return result.replace(QUOTE, EMPTY)
  }

  return result.replace(ALL, EMPTY)
}
410383
function(options, type) {
    return _.without(_.map(options, function(option) {
      if (option[type]) {
        option[type].name = option.name;
        return option[type];
      }
    }), undefined);
  }
814487
function parseOptions(options) {
    const defaults = {
        singleline: 1,
        multiline: 1,
        allowFirstLine: false,
    }

    if (options) {
        if (options.singleline) {
            if (typeof options.singleline === "number") {
                defaults.singleline = options.singleline
            } else if (options.singleline.max) {
                defaults.singleline = options.singleline.max
            }
        }

        if (options.multiline) {
            if (typeof options.multiline === "number") {
                defaults.multiline = options.multiline
            } else {
                if (options.multiline.max) {
                    defaults.multiline = options.multiline.max
                }

                if (options.multiline.allowFirstLine) {
                    defaults.allowFirstLine = options.multiline.allowFirstLine
                }
            }
        }
    }

    return defaults
}
938191
function(options) {
  var config = _.clone(options) || {};

  config.ignoredTypes = _.clone(Syphon.ignoredTypes);
  config.inputReaders = config.inputReaders || Syphon.InputReaders;
  config.inputWriters = config.inputWriters || Syphon.InputWriters;
  config.keyExtractors = config.keyExtractors || Syphon.KeyExtractors;
  config.keySplitter = config.keySplitter || Syphon.KeySplitter;
  config.keyJoiner = config.keyJoiner || Syphon.KeyJoiner;
  config.keyAssignmentValidators = config.keyAssignmentValidators || Syphon.KeyAssignmentValidators;

  return config;
}
42709
function normalizeErr(err, config) {
  const { name, message, actual, expected, stack, showDiff } = err;
  let errMessage;
  let errDiff;

  /**
   * Check that a / b have the same type.
   */
  function sameType(a, b) {
    const objToString = Object.prototype.toString;
    return objToString.call(a) === objToString.call(b);
  }

  // Format actual/expected for creating diff
  if (showDiff !== false && sameType(actual, expected) && expected !== undefined) {
    /* istanbul ignore if */
    if (!(_.isString(actual) && _.isString(expected))) {
      err.actual = mochaUtils.stringify(actual);
      err.expected = mochaUtils.stringify(expected);
    }
    errDiff = config.useInlineDiffs ? createInlineDiff(err) : createUnifiedDiff(err);
  }

  // Assertion libraries do not output consitent error objects so in order to
  // get a consistent message object we need to create it ourselves
  if (name && message) {
    errMessage = `${name}: ${stripAnsi(message)}`;
  } else if (stack) {
    errMessage = stack.replace(/\n.*/g, '');
  }

  return {
    message: errMessage,
    estack: stack && stripAnsi(stack),
    diff: errDiff
  };
}
1317982
function normalizeOptions(options) {
    const pathToBin = path.join(process.cwd(), 'node_modules', '.bin');
    const pathName = /^win/.test(process.platform) ? 'Path' : 'PATH';
    const newPath = pathToBin + path.delimiter + process.env[pathName];

    return _.extend({
        elmTest: 'elm-test',
        args: [],
        verbose: false,
        errorMessage: 'Running tests for `<%= file.path %>` failed with exit code <%= error.code %>',
        quiet: false,
        cwd: process.cwd(),
        env: _.extend(process.env, _.fromPairs([[pathName, newPath]]), options ? options.env : undefined),
    }, options);
}
524150
function normalizeOptions(options, Ctor) {
  if (!options) {
    return null;
  }

  if (options instanceof Ctor) {
    return options;
  }

  var instance = new Ctor();

  Object.keys(options).forEach(function(key) {
    if (typeof options[key] !== "undefined") {
      instance[key] = options[key];
    }
  });

  return instance;
}
91817
function normalizeOptionValue(value) {
    let multiline = false;
    let minProperties = Number.POSITIVE_INFINITY;
    let consistent = false;

    if (value) {
        if (value === "always") {
            minProperties = 0;
        } else if (value === "never") {
            minProperties = Number.POSITIVE_INFINITY;
        } else {
            multiline = Boolean(value.multiline);
            minProperties = value.minProperties || Number.POSITIVE_INFINITY;
            consistent = Boolean(value.consistent);
        }
    } else {
        consistent = true;
    }

    return { multiline, minProperties, consistent };
}