Download wp-calypso/client/state/imports/url-analyzer/reducer.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/imports/url-analyzer/reducer.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/imports/url-analyzer/reducer.ts
-
curl -L -o reducer.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/imports/url-analyzer/reducer.ts
1.23 kB
| import { combineReducers } from 'calypso/state/utils'; | |
| import { | |
| URL_ANALYZER_ANALYZE, | |
| URL_ANALYZER_ANALYZE_DONE, | |
| URL_ANALYZER_ANALYZE_SUCCESS, | |
| URL_ANALYZER_ANALYZE_ERROR, | |
| URL_ANALYZER_RESET_ERROR, | |
| URL_ANALYZER_URL_DATA_UPDATE, | |
| } from '../../action-types'; | |
| import type { AnyAction } from 'redux'; | |
| const isAnalyzing = ( state = false, action: AnyAction ) => { | |
| switch ( action.type ) { | |
| case URL_ANALYZER_ANALYZE: | |
| return true; | |
| case URL_ANALYZER_ANALYZE_DONE: | |
| return false; | |
| } | |
| return state; | |
| }; | |
| const analyzerError = ( state = null, action: AnyAction ) => { | |
| switch ( action.type ) { | |
| case URL_ANALYZER_ANALYZE_ERROR: { | |
| const { payload } = action; | |
| return payload; | |
| } | |
| case URL_ANALYZER_RESET_ERROR: | |
| return null; | |
| default: | |
| return state; | |
| } | |
| }; | |
| const urlData = ( state = null, action: AnyAction ) => { | |
| switch ( action.type ) { | |
| case URL_ANALYZER_ANALYZE_SUCCESS: { | |
| const { payload } = action; | |
| return payload; | |
| } | |
| case URL_ANALYZER_URL_DATA_UPDATE: { | |
| const { payload } = action; | |
| return payload; | |
| } | |
| default: | |
| return state; | |
| } | |
| }; | |
| const reducer = combineReducers( { | |
| isAnalyzing, | |
| urlData, | |
| analyzerError, | |
| } ); | |
| export type State = ReturnType< typeof reducer >; | |
| export default reducer; | |