This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from: https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color | |
const color = { | |
Reset : "\x1b[0m", | |
Bright : "\x1b[1m", | |
Dim : "\x1b[2m", | |
Underscore : "\x1b[4m", | |
Blink : "\x1b[5m", | |
Reverse : "\x1b[7m", | |
Hidden : "\x1b[8m", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired By | |
// https://stackoverflow.com/questions/6213227/fastest-way-to-convert-a-number-to-radix-64-in-javascript | |
// Haven't Fully Tested or implemented in a prod environment | |
// Generate Random Value matching a guid | |
const Guid = (): string => { | |
return 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/gi, () => { | |
const crypto = require('crypto'); | |
const id = crypto.randomBytes(16).toString("hex")[5]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const hookFetch = global.fetch; | |
type collection = { | |
[key: string]: { | |
response: { | |
success?: unknown | |
error?: unknown | |
} | |
headers?: { | |
[key: string]: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const b64ToGuid = (b64) => { | |
const bytes = Buffer.from(b64, "base64"); | |
bits = []; | |
bytes.forEach(byte => { | |
bits.push(byte.toString(16).padStart(2, '0')); | |
}); | |
const data = bits.join(""); | |
const parts = []; | |
parts.push(data.substring(0, 8).split("").reverse().join("")); |
OlderNewer