File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { sha256 } from '@noble/hashes/sha2.js' ;
2- import { bytesToHex , utf8ToBytes } from '@noble/hashes/utils.js' ;
2+ import { utf8ToBytes } from '@noble/hashes/utils.js' ;
33
44export function hasValue ( o : unknown ) : boolean {
55 return undefined !== o && null !== o ;
66}
77
88export function hashString ( str : string ) {
9- return bytesToHex ( sha256 ( utf8ToBytes ( str ) ) ) ;
9+ return sha256 ( utf8ToBytes ( str ) ) . toHex ( ) ;
1010}
1111
1212export function isSearchKeyboardEvent ( e : KeyboardEvent ) {
1313 return ( e . ctrlKey || e . metaKey ) && e . key . toLowerCase ( ) === 'f' ;
1414}
15-
16- export function escapeHTML ( str : string ) {
17- return str . replace (
18- / [ & < > " ' ] / g,
19- ( match ) =>
20- ( < Record < string , string > > {
21- '&' : '&' ,
22- '<' : '<' ,
23- '>' : '>' ,
24- '"' : '"' ,
25- "'" : ''' ,
26- } ) [ match ] ,
27- ) ;
28- }
You can’t perform that action at this time.
0 commit comments