react-code-dataset / wp-calypso /apps /notifications /src /panel /state /selectors /get-is-note-liked.js
react-code-dataset / wp-calypso /apps /notifications /src /panel /state /selectors /get-is-note-liked.js
Download wp-calypso/apps/notifications/src/panel/state/selectors/get-is-note-liked.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/notifications/src/panel/state/selectors/get-is-note-liked.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/apps/notifications/src/panel/state/selectors/get-is-note-liked.js
-
curl -L -o get-is-note-liked.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/notifications/src/panel/state/selectors/get-is-note-liked.js
509 Bytes
| import { getActions } from '../../helpers/notes'; | |
| import getNotes from './get-notes'; | |
| export const getIsNoteLiked = ( notesState, note ) => { | |
| const noteLikes = notesState.noteLikes; | |
| if ( noteLikes.hasOwnProperty( note.id ) ) { | |
| return noteLikes[ note.id ]; | |
| } | |
| const actionMeta = getActions( note ); | |
| const likeProperty = note.meta.ids.comment ? 'like-comment' : 'like-post'; | |
| return actionMeta[ likeProperty ] ?? false; | |
| }; | |
| export default ( state, note ) => getIsNoteLiked( getNotes( state ), note ); | |