Download wp-calypso/client/site-profiler/utils/format-ms-value.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/site-profiler/utils/format-ms-value.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/site-profiler/utils/format-ms-value.ts
-
curl -L -o format-ms-value.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/site-profiler/utils/format-ms-value.ts
447 Bytes
| import { translate } from 'i18n-calypso'; | |
| export const formatMsValue = ( msValue: number ): React.ReactElement | string | number => { | |
| if ( msValue < 1000 ) { | |
| return translate( '%(value)sms', { | |
| comment: 'value to be displayed in milliseconds', | |
| args: { value: Math.floor( msValue ) }, | |
| } ); | |
| } | |
| return translate( '%(value)ss', { | |
| comment: 'value to be displayed in seconds', | |
| args: { value: ( msValue / 1000 ).toFixed( 2 ) }, | |
| } ); | |
| }; | |