mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-24 01:39:53 +02:00
Merge branch 'develop' into sidv/typescript
* develop: (50 commits) Build docs chore: update browsers list Fix pre Fix mermaid code formatting in html Prettier pass Fix XSS htmls fix #3407 Replace `div` with `pre` and format Add change in `src/docs` Fix lint issue build: run `build:prod` on `yarn prepare` Build documentation Fix typo Fix typo in documentation Fix doc Add files only when running from lint-staged Add files only when running from lint-staged Fix configuration doc Prettier Pass Add dotfiles Prettier ...
This commit is contained in:
15
src/utils.ts
15
src/utils.ts
@@ -45,6 +45,7 @@ const anyComment = /\s*%%.*\n/gm;
|
||||
* @function detectInit Detects the init config object from the text
|
||||
* @param config
|
||||
*
|
||||
* @param config
|
||||
* ```mermaid
|
||||
*
|
||||
* %%{init: {"theme": "debug", "logLevel": 1 }}%%
|
||||
@@ -328,7 +329,7 @@ const calcLabelPosition = (points) => {
|
||||
|
||||
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
||||
let prevPoint;
|
||||
let totalDistance = 0; // eslint-disable-line
|
||||
let totalDistance = 0;
|
||||
log.info('our points', points);
|
||||
if (points[0] !== initialPosition) {
|
||||
points = points.reverse();
|
||||
@@ -388,7 +389,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
|
||||
// Todo looking to faster cloning method
|
||||
let points = JSON.parse(JSON.stringify(_points));
|
||||
let prevPoint;
|
||||
let totalDistance = 0; // eslint-disable-line
|
||||
let totalDistance = 0;
|
||||
log.info('our points', points);
|
||||
if (position !== 'start_left' && position !== 'start_right') {
|
||||
points = points.reverse();
|
||||
@@ -947,12 +948,18 @@ export interface DetailedError {
|
||||
hash: any;
|
||||
}
|
||||
|
||||
/** @param error */
|
||||
/**
|
||||
*
|
||||
* @param error
|
||||
*/
|
||||
export function isDetailedError(error: unknown): error is DetailedError {
|
||||
return 'str' in error;
|
||||
}
|
||||
|
||||
/** @param error */
|
||||
/**
|
||||
*
|
||||
* @param error
|
||||
*/
|
||||
export function getErrorMessage(error: unknown): string {
|
||||
if (error instanceof Error) return error.message;
|
||||
return String(error);
|
||||
|
Reference in New Issue
Block a user