Updated download functions & added CSV serializer
All checks were successful
Build / Build NPM Project (push) Successful in 25s
Build / Tag Version (push) Successful in 6s

This commit is contained in:
2024-09-22 03:35:12 -04:00
parent 3bf8c7bd09
commit 51549db3d9
5 changed files with 59 additions and 28 deletions

View File

@ -1,3 +1,5 @@
import {dotNotation, flattenObj} from './objects.ts';
/**
* String of all letters
*/
@ -18,16 +20,6 @@ const SYMBOL_LIST = '~`!@#$%^&*()_-+={[}]|\\:;"\'<,>.?/';
*/
const CHAR_LIST = LETTER_LIST + NUMBER_LIST + SYMBOL_LIST;
/**
* Generate a random hexadecimal value
*
* @param {number} length Number of hexadecimal place values
* @return {string} Hexadecimal number as a string
*/
export function randomHex(length: number) {
return Array(length).fill(null).map(() => Math.round(Math.random() * 0xF).toString(16)).join('');
}
/**
* Convert number of bytes into a human-readable size
*
@ -95,6 +87,16 @@ export function pad(text: any, length: number, char: string = ' ', start = true)
return text.toString().padEnd(length, char);
}
/**
* Generate a random hexadecimal value
*
* @param {number} length Number of hexadecimal place values
* @return {string} Hexadecimal number as a string
*/
export function randomHex(length: number) {
return Array(length).fill(null).map(() => Math.round(Math.random() * 0xF).toString(16)).join('');
}
/**
* Generate a string of random characters.
*