mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
Merge branch 'develop' into sidv/typescript
* develop: (22 commits) Fix for build by revering jsdoc Revert "chore(deps-dev): bump documentation from 13.2.0 to 14.0.0" Review comments. Add test for handling parameter names that are "default" Add test for handling parameter names that are keywords Add test for handling trailing whitespaces Add first C4 parser test chore(deps-dev): bump eslint-plugin-jest from 26.8.2 to 26.8.7 chore(deps-dev): bump documentation from 13.2.0 to 14.0.0 chore(deps-dev): bump terser-webpack-plugin from 5.3.4 to 5.3.5 chore(deps-dev): bump prettier-plugin-jsdoc from 0.3.38 to 0.4.1 test(e2e): add array and generic attributes erDiagram test test(common): add generic parser test test(parser): add tests for generics and arrays in erDiagram feat: add array and generic symbols for erDiagram Lint markdown Fix prettier formatting in vscode Prettier Fix `securityLevel` docs Update README.md ...
This commit is contained in:
@@ -134,6 +134,29 @@ const getUrl = (useAbsolute: boolean): string => {
|
||||
export const evaluate = (val: string | boolean): boolean =>
|
||||
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: string): string {
|
||||
let cleanedText = text;
|
||||
|
||||
if (text.indexOf('~') != -1) {
|
||||
cleanedText = cleanedText.replace('~', '<');
|
||||
cleanedText = cleanedText.replace('~', '>');
|
||||
|
||||
return parseGenericTypes(cleanedText);
|
||||
} else {
|
||||
return cleanedText;
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
getRows,
|
||||
sanitizeText,
|
||||
|
Reference in New Issue
Block a user