Download wp-calypso/client/state/selectors/can-current-user-for-sites.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 922 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/can-current-user-for-sites.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/can-current-user-for-sites.js
-
curl -L -o can-current-user-for-sites.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/can-current-user-for-sites.js
922 Bytes
| import { canCurrentUser } from 'calypso/state/selectors/can-current-user'; | |
| /** | |
| * Returns an object with a key/property for each site ID in the sites list. | |
| * Each property returns true if the current user has the specified capability for the site, | |
| * false if the user does not have the capability, or null if the capability | |
| * cannot be determined (if the site is not currently known, or if specifying | |
| * an invalid capability). | |
| * @param {Object} state Global state tree | |
| * @param {Array} siteIds List of site IDs | |
| * @param {string} capability Capability label | |
| * @returns {Object} Object map, keyed per site by current user capability | |
| */ | |
| export const canCurrentUserForSites = ( state, siteIds, capability ) => { | |
| return siteIds.reduce( ( map, siteId ) => { | |
| map[ siteId ] = canCurrentUser( state, siteId, capability ); | |
| return map; | |
| }, {} ); | |
| }; | |
| export default canCurrentUserForSites; | |