fix(id-generator): re-write generator to allow it to function properly after compiling in cli

This commit is contained in:
Ahmad Nassri
2021-04-12 15:56:17 -04:00
parent 1b3971d6da
commit 84f664de14
3 changed files with 16 additions and 14 deletions

View File

@@ -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 {