//transform underscore value to Capitalise //npm_test_clients to NPM Test Clients export function underScoreToCapitalize(str: string): string { let strArr: string[] = str.split("_") let result = ""; for (let i = 0; i < strArr.length; i++) { strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1); result += strArr[i] if (i < strArr.length - 1) { result += " " } } return result; } //convert given a col 'type' to html input type export function convertColTypeToInputType(colType: string): string { switch (colType) { case "Int": case "Int!": return "number" case "String": case "String!": return "text" case "date": case "date!": case "Date!": case "Date": return "date" case "numeric": case "Numeric": case "numeric!": case "Numeric!": case "select": case "Select": case "select!": case "Select!": return "number" case "image": case "Image": case "image!": case "Image!": return "text" default: return "text" } } export const formatTimeStamp = (date: string) => { const options: any = { day: "numeric", month: "short", year: "numeric", }; return new Intl.DateTimeFormat("en-US", options) .format(new Date(date)) .toString(); } export function getType(type: string) { switch (type) { case "image": case "image!": return "String" case "video": case "video!": return "String" case "audio": case "audio!": return "String" default: return type } } export function isFileType(type: string) { switch (type) { case "image": case "image!": case "video": case "video!": case "audio": case "audio!": return true default: return false } }