Download wp-calypso/client/state/active-promotions/selectors.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 829 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/active-promotions/selectors.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/active-promotions/selectors.js
-
curl -L -o selectors.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/active-promotions/selectors.js
829 Bytes
| import 'calypso/state/active-promotions/init'; | |
| /** | |
| * Return WordPress activePromotions getting from state object | |
| * @param {Object} state - current state object | |
| * @returns {Array} WordPress activePromotions | |
| */ | |
| export function getActivePromotions( state ) { | |
| return state.activePromotions.items; | |
| } | |
| /** | |
| * Return if promotion is active | |
| * @param {Object} state - current state object | |
| * @param {string} name - promotion name | |
| * @returns {boolean} Is promotion active? | |
| */ | |
| export function hasActivePromotion( state, name ) { | |
| return getActivePromotions( state ).indexOf( name ) !== -1; | |
| } | |
| /** | |
| * Return requesting state | |
| * @param {Object} state - current state object | |
| * @returns {boolean} is activePromotions requesting? | |
| */ | |
| export function isRequestingActivePromotions( state ) { | |
| return state.activePromotions.requesting; | |
| } | |