#851 Use predictive unique id generation

This commit is contained in:
Dolan Miu
2021-03-24 03:02:58 +00:00
parent 72389e25a1
commit ebaf0dfbf0
2 changed files with 114 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { customAlphabet, nanoid } from "nanoid/non-secure";
import { nanoid } from "nanoid/non-secure";
const numericNanoId = customAlphabet("0123456789", 15);
let currentCount = 0;
// Twip - twentieths of a point
export const convertMillimetersToTwip = (millimeters: number): number => {
@ -12,7 +12,7 @@ export const convertInchesToTwip = (inches: number): number => {
};
export const uniqueNumericId = (): number => {
return parseFloat(numericNanoId());
return currentCount++;
};
export const uniqueId = (): string => {