$optionTags may be closure, collection or an array of name => values.
515734
public function selectTag($name, $optionTags, array $options = [])
    {
        # This is found also in Form::select()
        if (!is_string($optionTags)) {
            if (is_array($optionTags) && isset($optionTags[0]) && isset($optionTags[1])) {
                list ($optionTags, $value) = $optionTags;
            } else {
                $value = null;
            }
            $optionTags = $this->optionsForSelect($optionTags, $value);
        }
        
        $this->normalizeSelectOptions($options, $optionTags);
        
        return $this->formFieldTag('select', $name, $optionTags, $options, true);
    }
667627
def []=(flag, value)
      if o = option(flag)
        o.value = value
      else
        raise ArgumentError, "no option with flag `#{flag}'"
      end
    end
1257378
public function optionsForSelect($options, $tag_value = null)
    {
        # New feature: accept anonymous functions that will return options.
        if ($options instanceof Closure) {
            $options = $options();
        /**
         * New feature: accept collection as option in index 0, in index 1 the option name and in index 2 the value
         * which are the properties of the models that will be used.
         * Example: [ Category::all(), 'name', 'id' ]
         * The second and third indexes can be either:
         *  - An attribute name
         *  - A public property
         *  - A method of the model that will return the value for the option/name
         */
        } elseif (is_array($options) && count($options) == 3 && ArrayTools::isIndexed($options) && $options[0] instanceof \Rails\ActiveModel\Collection) {
            list($models, $optionName, $valueName) = $options;
            
            $options = [];
            if ($models->any()) {
                $modelClass = get_class($models[0]);
            
                foreach ($models as $m) {
                    if ($modelClass::isAttribute($optionName)) {
                        $option = $m->getAttribute($optionName);
                    } elseif ($modelClass::hasPublicProperty($optionName)) {
                        $option = $m->$optionName;
                    } else {
                        # We assume it's a method.
                        $option = $m->$optionName();
                    }
                    
                    if ($modelClass::isAttribute($valueName)) {
                        $value = $m->getAttribute($valueName);
                    } elseif ($modelClass::hasPublicProperty($optionName)) {
                        $option = $m->$optionName;
                    } else {
                        # We assume it's a method.
                        $value = $m->$valueName();
                    }
                    
                    $options[$option] = $value;
                }
            }
        }
        $tag_value = (string)$tag_value;
        
        $tags = [];
        foreach ($options as $name => $value) {
            $value = (string)$value;
            $tags[] = $this->_form_field_tag('option', null, $name, array('selected' => $value === $tag_value ? '1' : '', 'id' => '', 'value' => $value), true);
        }
        
        return implode("\n", $tags);
    }
379148
function parseOptions(options) {
    return Object.assign(
        {
            startTag: "never",
            endTag: "never",
            selfClosingTag: "always",

            detectType(node) {
                if (node.type === "HTMLStartTag") {
                    const closeType = node.tagClose.type
                    if (closeType === "HTMLSelfClosingTagClose") {
                        return this.selfClosingTag
                    }
                    return this.startTag
                }
                // HTMLEndTag
                return this.endTag
            },
        },
        options
    )
}
341633
function isTaggedAs(taggedItem, name, value, namespace, namespaceEx) {
  return taggedAs(taggedItem, name, namespace, namespaceEx) == value;           // == is intentional
}
635117
function arrayContainsItem(array, value, options) {
  if (array && _.indexOf(array, value) >= 0) {
    return options.fn(this);
  }

  return options.inverse(this);
}
1284362
function handleExprList (node, options) {
  const values = node.value.map((valueNode) => traverse(valueNode, options)).join(',')
  return `(${values})`
}
1077980
function (item, dontPushVal, options)
        {
            var self = this;

            if (self.options.maxTags && self.itemsArray.length >= self.options.maxTags)
            {
                return;
            }

            // Ignore false values, except false
            if (item !== false && !item)
            {
                return;
            }

            // Trim value
            if (typeof item === "string" && self.options.trimValue)
            {
                item = $.trim(item);
            }

            // CapitalizeFirstLetter
            if (typeof item === "string" && self.options.CapitalizeFirstLetterOnly)
            {
                item = item.charAt(0).toUpperCase() + item.slice(1);
            }

            // Throw an error when trying to add an object while the itemValue option was not set
            if (typeof item === "object" && !self.objectItems)
            {
                throw("Can't add objects when itemValue option is not set");
            }

            // Ignore strings only contain whitespace
            if (item.toString().match(/^\s*$/))
            {
                return;
            }

            if (typeof item === "string" && this.$element[0].tagName === 'INPUT')
            {
                var items = item.split(',');
                if (items.length > 1)
                {
                    for (var i = 0; i < items.length; i++)
                    {
                        this.add(items[i], true);
                    }

                    if (!dontPushVal)
                    {
                        self.pushVal();
                    }
                    return;
                }
            }

            var itemValue = self.options.itemValue(item),
                itemText  = self.options.itemText(item),
                tagClass  = self.options.tagClass(item),
                itemTitle = self.options.itemTitle(item);

            // Ignore empty tags
            if (itemText == '' || itemText == undefined){
                return;
            }

            // Ignore items all ready added
            var existing = $.grep(self.itemsArray, function (item) { return self.options.itemValue(item) === itemValue; })[0];
            if (existing && !self.options.allowDuplicates)
            {
                // Invoke onTagExists
                if (self.options.onTagExists)
                {
                    var $existingTag = $(".tag", self.$container).filter(function () { return $(this).data("item") === existing; });
                    self.options.onTagExists(item, $existingTag);
                }
                return;
            }

            // if length greater than limit
            if (self.items().toString().length + item.length + 1 > self.options.maxInputLength)
            {
                return;
            }

            // raise beforeItemAdd arg
            var beforeItemAddEvent = $.Event('beforeItemAdd', {item : item, cancel : false, options : options});
            self.$element.trigger(beforeItemAddEvent);
            if (beforeItemAddEvent.cancel)
            {
                return;
            }

            // register item in internal array and map
            self.itemsArray.push(item);

            // add a tag element
            var $tag = $('<span class="' + htmlEncode(tagClass) + (itemTitle !== null ? ('" title="' + itemTitle) : '') + '">' + htmlEncode(itemText) + '<i class="material-icons" data-role="remove">close</i></span>');
            $tag.data('item', item);
            self.findInputWrapper().before($tag);
            $tag.after(' ');

            if (!dontPushVal)
            {
                self.pushVal();
            }

            // Add class when reached maxTags
            if (self.options.maxTags === self.itemsArray.length || self.items().toString().length === self.options.maxInputLength)
            {
                self.$container.addClass('materialize-tags-max');
                self.$input.blur();
                self.$input.prop('readOnly', true);
            }

            self.$element.trigger($.Event('itemAdded', {item : item, options : options}));
        }
238423
public static function select(Collection $data, $selected = 0, $options = [], $htmlOptions = [])
    {
        if (empty($options['valueColumn']))
            $options['valueColumn'] = Model::PK;
        if (empty($options['titleColumn']))
            $options['titleColumn'] = 'title';
        if (is_array($selected))
            $selected = $selected[$options['valueColumn']];
        if ($selected instanceof Model) {
            $selected = $selected->{$options['valueColumn']};
        }
        if (empty($options['disabled']))
            $options['disabled'] = [];

        if ($options instanceof Std) {
            $options = $options->getData();
        }

        $htmlOptionsText = [];
        foreach ($htmlOptions as $key => $value) {
            if (is_numeric($key)) {
                $htmlOptionsText[] = $value;
            } else {
                $htmlOptionsText[] = $key . '="' . $value . '"';
            }
        }
        $htmlOptionsText = implode(' ', $htmlOptionsText);

        $html = '<select ' . $htmlOptionsText . '>' . "\n";
        if (
            isset($options['null']) && $options['null']
            &&
            $data->first()[$options['valueColumn']] !== 0 && $data->first()[$options['titleColumn']] !== '---'
        ) {
            $data->prepend([$options['valueColumn'] => 0, $options['titleColumn'] => '---']);
        }
        foreach ($data as $item) {
            $html .=
                '<option
                    value="' . $item[$options['valueColumn']] . '"' .
                ($item[$options['valueColumn']] == $selected ? ' selected="selected"' : '') .
                (in_array($item[$options['valueColumn']], $options['disabled']) ? ' disabled="disabled"' : '') .
                '>' .
                (
                    in_array('tree', $options) && isset($options['treeLevelColumn']) && isset($item[$options['treeLevelColumn']])
                        ? str_repeat(self::TREE_LEVEL_SYMBOL, (int)$item[$options['treeLevelColumn']])
                        : ''
                ) . ' ' .
                $item[$options['titleColumn']] .
                '</option>' . "\n";
        }
        $html .= '</select>';
        return $html;
    }
379059
function wrapItUp(){
		let optValue = currentOption.values;
		
		// Don't store solitary values in an array. Store them directly as strings
		if(1 === currentOption.arity && !currentOption.variadic)
			optValue = optValue[0];

		setValue(currentOption, optValue);
		currentOption.values = [];
		currentOption = null;
	}
1369893
function set($k, $v, $tags = []) {
		if ($v instanceof ICached) {
			$tags += $v->tags();
		}
		$this->_data[$k] = $v;
		foreach ($tags as $tag) { /** @var string $tag */
			if (!isset($this->_tags[$tag])) {
				$this->_tags[$tag] = [$k];
			}
			else if (!in_array($k, $this->_tags[$tag])) {
				$this->_tags[$tag][] = $k;
			}
		}
		return $v;
	}
1195969
public static function checkOrSet($option, $array, $possibleValues)
    {
        if (!isset($array[$option])) {
            $array[$option] = $possibleValues[0];

            return $array;
        }

        $ignoredOptions = ['team', 'foreignKeyName'];

        if (!in_array($option, $ignoredOptions) && !in_array($array[$option], $possibleValues, true)) {
            throw new InvalidArgumentException();
        }

        return $array;
    }
289215
def value
      case tag_name
      when "select"
        if self[:multiple]
          selected_options.map { |option| option.value }
        else
          selected_option = @_node.selected_options.first
          selected_option ? Node.new(selected_option).value : nil
        end
      when "option"
        self[:value] || text
      when "textarea"
        @_node.getText
      else
        self[:value]
      end
    end
13160
function(name, property, value, types) {
  if (!(types instanceof Array)) {
    types = [types];
  }
  if (types.indexOf(typeof value) === -1) {
    debug('%s \'%s\' expected %j got: %j', name, property, types, value);
    throw new Error(name + ' \'' + property + '\' expected one of type(s): \'' +
                    types.join(',') + '\' got type: \'' + typeof value + '\'');
  }
}
603238
public function selectTag($name, $options, array $attrs = [])
    {
        # This is found also in Form::select()
        if (!is_string($options)) {
            if (is_array($options) && ArrayTools::isIndexed($options) && count($options) == 2)
                list ($options, $value) = $options;
            else
                $value = null;
            $options = $this->optionsForSelect($options, $value);
        }
        
        if (isset($attrs['prompt'])) {
            $options = $this->contentTag('option', $attrs['prompt'], ['value' => '', 'allow_blank_attrs' => true]) . "\n" . $options;
            unset($attrs['prompt']);
        }
        $attrs['value'] = $attrs['type'] = null;
        
        $select_tag = $this->_form_field_tag('select', $name, $options, $attrs, true);
        return $select_tag;
    }
873074
function optionToArray(val, defVal) {
			if (val === undefined) {
				val = defVal;
			}
			if (!val) {
				return [];
			}
			if (typeof val !== 'string') {
				return val;
			}
			return val.split(',').map(_.trim);
		}
1021429
function validateOptions(options) {
  if (!options) {
    return;
  }

  utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) {
    if (!options.hasOwnProperty(key)) {
      return;
    }
    if (!utils.isArray(options[key]) || options[key].length !== 2) {
      throw new Error('Option "' + key + '" must be an array containing 2 different control strings.');
    }
    if (options[key][0] === options[key][1]) {
      throw new Error('Option "' + key + '" open and close controls must not be the same.');
    }
    utils.each(options[key], function (a, i) {
      if (a.length < 2) {
        throw new Error('Option "' + key + '" ' + ((i) ? 'open ' : 'close ') + 'control must be at least 2 characters. Saw "' + a + '" instead.');
      }
    });
  });

  if (options.hasOwnProperty('cache')) {
    if (options.cache && options.cache !== 'memory') {
      if (!options.cache.get || !options.cache.set) {
        throw new Error('Invalid cache option ' + JSON.stringify(options.cache) + ' found. Expected "memory" or { get: function (key) { ... }, set: function (key, value) { ... } }.');
      }
    }
  }
  if (options.hasOwnProperty('loader')) {
    if (options.loader) {
      if (!options.loader.load || !options.loader.resolve) {
        throw new Error('Invalid loader option ' + JSON.stringify(options.loader) + ' found. Expected { load: function (pathname, cb) { ... }, resolve: function (to, from) { ... } }.');
      }
    }
  }

}