export const createPlaceholders = ( arr: any[] ) => { return arr.map(() => '?').join(', '); } export type AddDollarPrefix = { [K in keyof T as `$${string & K}`]: T[K]; }; export function prefixKeysWithDollar>(obj: T): AddDollarPrefix { const result = {} as AddDollarPrefix; for (const key in obj) { const newKey = `$${key}` as keyof AddDollarPrefix; result[newKey] = obj[key] as any; } return result; } export function transformArray>(arr: T[]): AddDollarPrefix[] { return arr.map(prefixKeysWithDollar); } export function pad_l2 ( _thing: string | number ): string { if ( typeof _thing == "number" ) { _thing = JSON.stringify(_thing); }; return _thing.padStart(2, "0"); } export function getTsNow() { const now = new Date(); const rtn = { year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(), minute: now.getMinutes(), seconds: now.getSeconds() } return rtn; }