Download wp-calypso/client/server/lib/is-static-request/index.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/server/lib/is-static-request/index.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/server/lib/is-static-request/index.ts
-
curl -L -o index.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/server/lib/is-static-request/index.ts
466 Bytes
| type PartialReq = { | |
| originalUrl: string; | |
| }; | |
| const STATIC_PATHS = [ | |
| '/calypso/', | |
| '/service-worker', | |
| '/nostats.js', | |
| '/__webpack_hmr', | |
| '_favicon.ico', | |
| ]; | |
| /** | |
| * Returns true if the request is to a static file, like JS bundles. | |
| * @param req The express request object | |
| */ | |
| export default function isStaticRequest( req: PartialReq ) { | |
| if ( ! req?.originalUrl ) { | |
| return false; | |
| } | |
| return STATIC_PATHS.some( ( path ) => req.originalUrl.startsWith( path ) ); | |
| } | |