Improve import alias
@file/ and @export/ instead of file/ and export/ etc
This commit is contained in:
20
src/util/convenience-functions.ts
Normal file
20
src/util/convenience-functions.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { nanoid } from "nanoid/non-secure";
|
||||
|
||||
let currentCount = 0;
|
||||
|
||||
// Twip - twentieths of a point
|
||||
export const convertMillimetersToTwip = (millimeters: number): number => {
|
||||
return Math.floor((millimeters / 25.4) * 72 * 20);
|
||||
};
|
||||
|
||||
export const convertInchesToTwip = (inches: number): number => {
|
||||
return Math.floor(inches * 72 * 20);
|
||||
};
|
||||
|
||||
export const uniqueNumericId = (): number => {
|
||||
return ++currentCount;
|
||||
};
|
||||
|
||||
export const uniqueId = (): string => {
|
||||
return nanoid().toLowerCase();
|
||||
};
|
Reference in New Issue
Block a user