Rename files part 2

This commit is contained in:
Misode
2020-11-23 14:39:04 +01:00
parent 3172557e3a
commit 35aefea261
16 changed files with 20 additions and 20 deletions

12
src/app/Utils.ts Normal file
View File

@@ -0,0 +1,12 @@
const dec2hex = (dec: number) => ('0' + dec.toString(16)).substr(-2)
export function hexId(length = 12) {
var arr = new Uint8Array(length / 2)
window.crypto.getRandomValues(arr)
return Array.from(arr, dec2hex).join('')
}
export function htmlEncode(str: string) {
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g, '&#x2F;')
}