/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/utils/generateHash.ts
11 строк
518 B
KROSY
fix: fix top queries table row height (#565)
24 окт 2023, 16:17
Не верифицирован
24 окт 2023, 16:17
b12dceb
Код
Авторство
О чём код?
import crc32 from 'crc-32'; export const generateHash = (value: string) => { // 1. crc32.str(value) - generate crc32 hash // 2. (>>>) - use unsigned right shift operator (>>>) to avoid negative values // 3. toString(16) - convert hash to hex format // 4. toUpperCase() - convert hash to uppercase // 5. padStart(8, '0') - fill hash with leading zeros if hash length < 8 // eslint-disable-next-line no-bitwise return (crc32.str(value) >>> 0).toString(16).toUpperCase().padStart(8, '0'); };