2021-03-24 03:02:58 +00:00
|
|
|
import { nanoid } from "nanoid/non-secure";
|
2021-03-12 03:58:05 +00:00
|
|
|
|
2021-03-24 03:02:58 +00:00
|
|
|
let currentCount = 0;
|
2021-03-12 03:58:05 +00:00
|
|
|
|
2020-12-24 03:37:43 +00:00
|
|
|
// Twip - twentieths of a point
|
2022-08-31 07:52:27 +01:00
|
|
|
export const convertMillimetersToTwip = (millimeters: number): number => Math.floor((millimeters / 25.4) * 72 * 20);
|
2020-12-24 03:37:43 +00:00
|
|
|
|
2022-08-31 07:52:27 +01:00
|
|
|
export const convertInchesToTwip = (inches: number): number => Math.floor(inches * 72 * 20);
|
2021-03-12 03:58:05 +00:00
|
|
|
|
2022-08-31 08:59:27 +01:00
|
|
|
export const uniqueNumericId = (): number => ++currentCount;
|
2021-03-12 03:58:05 +00:00
|
|
|
|
2022-08-31 07:52:27 +01:00
|
|
|
export const uniqueId = (): string => nanoid().toLowerCase();
|