Download wp-calypso/packages/calypso-package-generator/utils/packageExists.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-package-generator/utils/packageExists.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/calypso-package-generator/utils/packageExists.js
-
curl -L -o packageExists.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/calypso-package-generator/utils/packageExists.js
448 Bytes
| /** | |
| * packageExists | |
| * | |
| * Check whether the given package exist or not | |
| */ | |
| import fs from 'fs'; | |
| import path from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); | |
| const packagePath = path.join( __dirname, '../../' ); | |
| const packageNames = fs.readdirSync( packagePath ); | |
| const packageExists = ( packageName ) => packageNames.includes( packageName ); | |
| export default packageExists; | |