feat: add array and generic symbols for erDiagram

This commit is contained in:
FlorianWoelki
2022-08-20 13:42:51 +02:00
parent a89b6fd054
commit ea3573c989
4 changed files with 30 additions and 25 deletions

View File

@@ -182,6 +182,29 @@ const getUrl = (useAbsolute) => {
*/
export const evaluate = (val) => (val === 'false' || val === false ? false : true);
/**
* Makes generics in typescript syntax
*
* @example <caption>Array of array of strings in typescript syntax</caption>
* // returns "Array<Array<string>>"
* parseGenericTypes('Array~Array~string~~');
*
* @param {string} text The text to convert
* @returns {string} The converted string
*/
export const parseGenericTypes = function (text) {
let cleanedText = text;
if (text.indexOf('~') != -1) {
cleanedText = cleanedText.replace('~', '<');
cleanedText = cleanedText.replace('~', '>');
return parseGenericTypes(cleanedText);
} else {
return cleanedText;
}
};
export default {
getRows,
sanitizeText,