Download wp-calypso/client/state/comments/ui/utils.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 765 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/comments/ui/utils.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/comments/ui/utils.js
-
curl -L -o utils.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/comments/ui/utils.js
765 Bytes
| /** | |
| * Creates a filters key to be used in the `comments.ui.queries` state. | |
| * E.g. `comments.ui.queries.${ siteId }.${ postId }.${ 'approved?s=foo' }.${ page }` | |
| * @param {Object} query Filter parameters. | |
| * @param {string} [query.order] Query order ('ASC' or 'DESC'). | |
| * @param {string} [query.search] Search query. | |
| * @param {string} query.status Comments status. | |
| * @returns {string} Filter key. | |
| */ | |
| export const getFiltersKey = ( { order = 'DESC', search, status = 'all' } ) => { | |
| const caseInsensitiveOrder = order.toUpperCase(); | |
| const orderFilter = [ 'ASC', 'DESC' ].includes( caseInsensitiveOrder ) | |
| ? caseInsensitiveOrder | |
| : 'DESC'; | |
| const searchFilter = search ? `&s=${ search }` : ''; | |
| return `${ status }?order=${ orderFilter }${ searchFilter }`; | |
| }; | |