deps/v8/src/js/i18n.js
function getGetOption(options, caller) {
  if (IS_UNDEFINED(options)) throw MakeError(kDefaultOptionsMissing, caller);

  var getOption = function getOption(property, type, values, defaultValue) {
    if (!IS_UNDEFINED(options[property])) {
      var value = options[property];
      switch (type) {
        case 'boolean':
          value = TO_BOOLEAN(value);
          break;
        case 'string':
          value = TO_STRING(value);
          break;
        case 'number':
          value = TO_NUMBER(value);
          break;
        default:
          throw MakeError(kWrongValueType);
      }

      if (!IS_UNDEFINED(values) && %_Call(ArrayIndexOf, values, value) === -1) {
        throw MakeRangeError(kValueOutOfRange, value, caller, property);
      }

      return value;
    }

    return defaultValue;
  }

  return getOption;
}
function getGetOption(options, caller) {
  if (IS_UNDEFINED(options)) throw MakeError(kDefaultOptionsMissing, caller);

  var getOption = function getOption(property, type, values, defaultValue) {
    if (!IS_UNDEFINED(options[property])) {
      var value = options[property];
      switch (type) {
        case 'boolean':
          value = TO_BOOLEAN(value);
          break;
        case 'string':
          value = TO_STRING(value);
          break;
        case 'number':
          value = TO_NUMBER(value);
          break;
        default:
          throw MakeError(kWrongValueType);
      }

      if (!IS_UNDEFINED(values) && %_Call(ArrayIndexOf, values, value) === -1) {
        throw MakeRangeError(kValueOutOfRange, value, caller, property);
      }

      return value;
    }

    return defaultValue;
  }

  return getOption;
}
Returns a getOption function that extracts property value for given
options object. If property is missing it returns defaultValue. If value
is out of range for that property it throws RangeError.