mirror of
https://github.com/strapi/strapi.git
synced 2025-07-18 22:45:47 +00:00
17 lines
432 B
JavaScript
17 lines
432 B
JavaScript
![]() |
/**
|
||
|
* componentExists
|
||
|
*
|
||
|
* Check whether the given component exist in either the components or containers directory
|
||
|
*/
|
||
|
|
||
|
const fs = require('fs');
|
||
|
const pageComponents = fs.readdirSync('app/components');
|
||
|
const pageContainers = fs.readdirSync('app/containers');
|
||
|
const components = pageComponents.concat(pageContainers);
|
||
|
|
||
|
function componentExists(comp) {
|
||
|
return components.indexOf(comp) >= 0;
|
||
|
}
|
||
|
|
||
|
module.exports = componentExists;
|