UNPKG

2.77 kBTypeScriptView Raw
1import { MermaidConfig } from '../../config.type.js';
2export declare const lineBreakRegex: RegExp;
3/**
4 * Gets the rows of lines in a string
5 *
6 * @param s - The string to check the lines for
7 * @returns The rows in that string
8 */
9export declare const getRows: (s?: string) => string[];
10/**
11 * Removes script tags from a text
12 *
13 * @param txt - The text to sanitize
14 * @returns The safer text
15 */
16export declare const removeScript: (txt: string) => string;
17export declare const sanitizeText: (text: string, config: MermaidConfig) => string;
18export declare const sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[];
19/**
20 * Whether or not a text has any line breaks
21 *
22 * @param text - The text to test
23 * @returns Whether or not the text has breaks
24 */
25export declare const hasBreaks: (text: string) => boolean;
26/**
27 * Splits on <br> tags
28 *
29 * @param text - Text to split
30 * @returns List of lines as strings
31 */
32export declare const splitBreaks: (text: string) => string[];
33/**
34 * Converts a string/boolean into a boolean
35 *
36 * @param val - String or boolean to convert
37 * @returns The result from the input
38 */
39export declare const evaluate: (val?: string | boolean) => boolean;
40/**
41 * Wrapper around Math.max which removes non-numeric values
42 * Returns the larger of a set of supplied numeric expressions.
43 * @param values - Numeric expressions to be evaluated
44 * @returns The smaller value
45 */
46export declare const getMax: (...values: number[]) => number;
47/**
48 * Wrapper around Math.min which removes non-numeric values
49 * Returns the smaller of a set of supplied numeric expressions.
50 * @param values - Numeric expressions to be evaluated
51 * @returns The smaller value
52 */
53export declare const getMin: (...values: number[]) => number;
54/**
55 * Makes generics in typescript syntax
56 *
57 * @example
58 * Array of array of strings in typescript syntax
59 *
60 * ```js
61 * // returns "Array<Array<string>>"
62 * parseGenericTypes('Array~Array~string~~');
63 * ```
64 * @param text - The text to convert
65 * @returns The converted string
66 */
67export declare const parseGenericTypes: (text: string) => string;
68declare const _default: {
69 getRows: (s?: string | undefined) => string[];
70 sanitizeText: (text: string, config: MermaidConfig) => string;
71 sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[];
72 hasBreaks: (text: string) => boolean;
73 splitBreaks: (text: string) => string[];
74 lineBreakRegex: RegExp;
75 removeScript: (txt: string) => string;
76 getUrl: (useAbsolute: boolean) => string;
77 evaluate: (val?: string | boolean | undefined) => boolean;
78 getMax: (...values: number[]) => number;
79 getMin: (...values: number[]) => number;
80};
81export default _default;