mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 22:09:57 +02:00
fix(id-generator): re-write generator to allow it to function properly after compiling in cli
This commit is contained in:
22
src/utils.js
22
src/utils.js
@@ -793,17 +793,19 @@ export const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
||||
d3Attrs(svgElem, attrs);
|
||||
};
|
||||
|
||||
export const initIdGeneratior = function(deterministic, seed) {
|
||||
if (!deterministic) return { next: () => Date.now() };
|
||||
class iterator {
|
||||
constructor() {
|
||||
return (this.count = seed ? seed.length : 0);
|
||||
}
|
||||
next() {
|
||||
return this.count++;
|
||||
}
|
||||
export const initIdGeneratior = class iterator {
|
||||
constructor (deterministic, seed) {
|
||||
this.deterministic = deterministic;
|
||||
this.seed = seed;
|
||||
|
||||
this.count = seed ? seed.length : 0
|
||||
}
|
||||
|
||||
next() {
|
||||
if (!this.deterministic) return Date.now();
|
||||
|
||||
return this.count++;
|
||||
}
|
||||
return new iterator();
|
||||
};
|
||||
|
||||
export default {
|
||||
|
Reference in New Issue
Block a user