docs/generate-metadata.js
function applyPropDoclets(props, propName) {
  let prop = props[propName];
  let doclets = prop.doclets;
  let value;

  // the @type doclet to provide a prop type
  // Also allows enums (oneOf) if string literals are provided
  // ex: @type {("optionA"|"optionB")}
  if (doclets.type) {
    value = cleanDocletValue(doclets.type);
    prop.type.name = value;

    if (value[0] === '(') {
      value = value.substring(1, value.length - 1).split('|');

      prop.type.value = value;
      prop.type.name = value.every(isLiteral) ? 'enum' : 'union';
    }
  }

  // Use @required to mark a prop as required
  // useful for custom propTypes where there isn't a `.isRequired` addon
  if (doclets.required) {
    prop.required = true;
  }

  // Use @defaultValue to provide a prop's default value
  if (doclets.defaultValue) {
    prop.defaultValue = cleanDocletValue(doclets.defaultValue);
  }
}
function applyPropDoclets(props, propName) {
  let prop = props[propName];
  let doclets = prop.doclets;
  let value;

  // the @type doclet to provide a prop type
  // Also allows enums (oneOf) if string literals are provided
  // ex: @type {("optionA"|"optionB")}
  if (doclets.type) {
    value = cleanDocletValue(doclets.type);
    prop.type.name = value;

    if (value[0] === '(') {
      value = value.substring(1, value.length - 1).split('|');

      prop.type.value = value;
      prop.type.name = value.every(isLiteral) ? 'enum' : 'union';
    }
  }

  // Use @required to mark a prop as required
  // useful for custom propTypes where there isn't a `.isRequired` addon
  if (doclets.required) {
    prop.required = true;
  }

  // Use @defaultValue to provide a prop's default value
  if (doclets.defaultValue) {
    prop.defaultValue = cleanDocletValue(doclets.defaultValue);
  }
}
function applyPropDoclets ( props , propName ) { let prop = props [ propName ] ; let doclets = prop . doclets ; let value ; // the @type doclet to provide a prop type // Also allows enums (oneOf) if string literals are provided // ex: @type {("optionA"|"optionB")} if ( doclets . type ) { value = cleanDocletValue ( doclets . type ) ; prop . type . name = value ; if ( value [ 0 ] === '(' ) { value = value . substring ( 1 , value . length - 1 ) . split ( '|' ) ; prop . type . value = value ; prop . type . name = value . every ( isLiteral ) ? 'enum' : 'union' ; } } // Use @required to mark a prop as required // useful for custom propTypes where there isn't a `.isRequired` addon if ( doclets . required ) { prop . required = true ; } // Use @defaultValue to provide a prop's default value if ( doclets . defaultValue ) { prop . defaultValue = cleanDocletValue ( doclets . defaultValue ) ; } }
Reads the JSDoc "doclets" and applies certain ones to the prop type data
This allows us to "fix" parsing errors, or unparsable data with JSDoc style comments

@param  {Object} props     Object Hash of the prop metadata
@param  {String} propName
Reads the JSDoc doclets and applies certain ones to the prop type data This allows us to fix parsing errors or unparsable data with JSDoc style comments