Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mjadach-iv committed Nov 27, 2024
1 parent 9b96855 commit 3fb1433
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ public/
src/index.tsx

# Created by github pipeline
gha-creds-*.json

src/utils/functions.ts
gha-creds-*.json
14 changes: 7 additions & 7 deletions src/utils/functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import jazzicon from "@metamask/jazzicon";
import jazzicon from '@metamask/jazzicon';
import { createHash } from 'crypto';

export function bubbleSortObject(arr: any[], key: string | number) {
Expand Down Expand Up @@ -140,9 +140,9 @@ function unround(value: string) {
}
}

export function toHex(str:string) {
export function toHex(str: string) {
var result = '';
for (var i=0; i<str.length; i++) {
for (var i = 0; i < str.length; i++) {
result += str.charCodeAt(i).toString(16);
}
return result;
Expand All @@ -152,15 +152,15 @@ export function toHexMD5(d: string) {
return createHash('md5').update(d).digest('hex');
}

export function generateBase64Jazz(string: string){
export function generateBase64Jazz(string: string) {
try {
const md5 = toHexMD5(string);
const jazzSvg = jazzicon(16, parseInt(md5.slice(2, 10), 16));
const html = jazzSvg.children[0].outerHTML.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"' );
const html = jazzSvg.children[0].outerHTML.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
const b64 = 'data:image/svg+xml;base64,' + btoa(html);
return b64;
} catch(e) {
console.log("Did not manage to create a jazzicon/", e)
} catch (e) {
console.log('Did not manage to create a jazzicon/', e);
return null;
}
}

0 comments on commit 3fb1433

Please sign in to comment.