scripts/utils/propTypesHandler.js
function propTypesDocsHandler(documentation, path) {
  const propTypesPath = getMemberValuePath(path, 'propTypes');
  const docComment = getDocblock(propTypesPath.parent);

  const statementPattern = /@.*\:/;
  const info = {};
  if (docComment) {
    const infoRaw = _.split(docComment, '\n');
    _.forEach(infoRaw, (statement) => {
      if (statement && statementPattern.test(statement)) {
        const key = statement.match(statementPattern)[0].slice(1, -1);
        info[key] = statement.split(statementPattern)[1].trim();
      }
    });
  }
  documentation.set('propsInfo', info);
}
function propTypesDocsHandler(documentation, path) {
  const propTypesPath = getMemberValuePath(path, 'propTypes');
  const docComment = getDocblock(propTypesPath.parent);

  const statementPattern = /@.*\:/;
  const info = {};
  if (docComment) {
    const infoRaw = _.split(docComment, '\n');
    _.forEach(infoRaw, (statement) => {
      if (statement && statementPattern.test(statement)) {
        const key = statement.match(statementPattern)[0].slice(1, -1);
        info[key] = statement.split(statementPattern)[1].trim();
      }
    });
  }
  documentation.set('propsInfo', info);
}
function propTypesDocsHandler ( documentation , path ) { const propTypesPath = getMemberValuePath ( path , 'propTypes' ) ; const docComment = getDocblock ( propTypesPath . parent ) ; const statementPattern = / @.*\: / ; const info = { } ; if ( docComment ) { const infoRaw = _ . split ( docComment , '\n' ) ; _ . forEach ( infoRaw , ( statement ) => { if ( statement && statementPattern . test ( statement ) ) { const key = statement . match ( statementPattern ) [ 0 ] . slice ( 1 , - 1 ) ; info [ key ] = statement . split ( statementPattern ) [ 1 ] . trim ( ) ; } } ) ; } documentation . set ( 'propsInfo' , info ) ; }
Extract info on the component props
Extract info on the component props