mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 06:20:07 +02:00
Add different id generators
This commit is contained in:
13
src/utils.js
13
src/utils.js
@@ -1,3 +1,4 @@
|
||||
import { sanitizeUrl } from '@braintree/sanitize-url';
|
||||
import {
|
||||
curveBasis,
|
||||
curveBasisClosed,
|
||||
@@ -12,9 +13,8 @@ import {
|
||||
curveStepBefore,
|
||||
select
|
||||
} from 'd3';
|
||||
import { logger } from './logger';
|
||||
import { sanitizeUrl } from '@braintree/sanitize-url';
|
||||
import common from './diagrams/common/common';
|
||||
import { logger } from './logger';
|
||||
// import cryptoRandomString from 'crypto-random-string';
|
||||
|
||||
// Effectively an enum of the supported curve types, accessible by name
|
||||
@@ -790,6 +790,15 @@ export const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
||||
d3Attrs(svgElem, attrs);
|
||||
};
|
||||
|
||||
export const initIdGeneratior = function(deterministic, seed) {
|
||||
if (!deterministic) return () => Date.now();
|
||||
const iterator = function() {
|
||||
return this.count++;
|
||||
};
|
||||
iterator.seed = seed ? seed.length : 0;
|
||||
return iterator;
|
||||
};
|
||||
|
||||
export default {
|
||||
assignWithDepth,
|
||||
wrapLabel,
|
||||
|
Reference in New Issue
Block a user