/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/mui-codemod/src/util/findComponentDefaultProps.js
17 строк
569 B
Diego Andai
[material-ui][Alert] Deprecate components and componentsProps props (#40681)
16 фев 2024, 16:52
Не верифицирован
16 фев 2024, 16:52
1077906
Код
Авторство
О чём код?
/** * Find all the default props path of a given component name. * * @param {import('jscodeshift')} j * @param {{ root: import('jscodeshift').Collection; componentName: string }} options * @returns {import('jscodeshift').Collection} * */ export default function findComponentDefaultProps(j, options) { const { root, componentName } = options; const defaultPropsPathCollection = root .find(j.ObjectProperty, { key: { name: `Mui${componentName}` } }) .find(j.ObjectProperty, { key: { name: 'defaultProps' } }); return defaultPropsPathCollection; }