Download spectrum/shared/clients/draft-js/utils/isShort.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 390 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/clients/draft-js/utils/isShort.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/shared/clients/draft-js/utils/isShort.js
-
curl -L -o isShort.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/clients/draft-js/utils/isShort.js
390 Bytes
| // @flow | |
| import { toPlainText } from './plaintext'; | |
| import type { MessageInfoType } from '../../../graphql/fragments/message/messageInfo'; | |
| export const isShort = (message: MessageInfoType): boolean => { | |
| if (message.messageType === 'media') return false; | |
| const jsonBody = JSON.parse(message.content.body); | |
| return jsonBody.blocks.length <= 1 && toPlainText(jsonBody).length <= 170; | |
| }; | |