UNPKG

@ogs-gmbh/ngx-utils

Version:

A lightweight collection of utility functions and helpers for Angular applications

1 lines 10.9 kB
{"version":3,"file":"ogs-gmbh-ngx-utils.mjs","sources":["../../../src/timestamp.ts","../../../src/storage.ts","../../../src/custom-validators.ts","../../../src/keyboard-keys.ts"],"sourcesContent":["/**\n * Static timestamp helper functions\n */\n/* eslint-disable-next-line @tseslint/no-extraneous-class */\nexport class TimestampUtil {\n /**\n * Validate timestamp by its value against current timestamp\n * @param {number} timestamp - Timestamp, that'll be checked\n * @return {boolean} - Returns true if Timestamp is greater than current Timestamp, otherwise false\n */\n public static isValidAgainstNow (timestamp: number): boolean {\n return timestamp > Date.now();\n }\n}\n","/**\n * Static storage helper methods\n *\n */\n/* eslint-disable-next-line @tseslint/no-extraneous-class */\nexport class StorageUtil {\n /**\n * Generate random UUID\n * @return {string} - Random UUID\n */\n public static generateRandomUUID (): string {\n return crypto.randomUUID();\n }\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from \"@angular/forms\";\n\nexport namespace CustomValidators {\n /* eslint-disable-next-line @tseslint/no-shadow */\n export const length = (requiredLength: number): ValidatorFn => (control: AbstractControl): ValidationErrors | null => ((control.value as string).length === requiredLength\n ? { invalid: true }\n : null);\n}\n","export namespace KeyboardKeys {\n export const BACKSPACE: string = \"Backspace\";\n export const ENTER: string = \"Enter\";\n export const COMMA: string = \",\";\n export const PERIOD: string = \".\";\n export const COLON: string = \":\";\n export const HASH: string = \"#\";\n export const SPACE: string = \" \";\n export const PLUS: string = \"+\";\n export const MINUS: string = \"-\";\n export const DIGIT_0: string = \"0\";\n export const DIGIT_1: string = \"1\";\n export const DIGIT_2: string = \"2\";\n export const DIGIT_3: string = \"3\";\n export const DIGIT_4: string = \"4\";\n export const DIGIT_5: string = \"5\";\n export const DIGIT_6: string = \"6\";\n export const DIGIT_7: string = \"7\";\n export const DIGIT_8: string = \"8\";\n export const DIGIT_9: string = \"9\";\n export const LOWER_A: string = \"a\";\n export const LOWER_B: string = \"b\";\n export const LOWER_C: string = \"c\";\n export const LOWER_D: string = \"d\";\n export const LOWER_E: string = \"e\";\n export const LOWER_F: string = \"f\";\n export const LOWER_G: string = \"g\";\n export const LOWER_H: string = \"h\";\n export const LOWER_I: string = \"i\";\n export const LOWER_J: string = \"j\";\n export const LOWER_K: string = \"k\";\n export const LOWER_L: string = \"l\";\n export const LOWER_M: string = \"m\";\n export const LOWER_N: string = \"n\";\n export const LOWER_O: string = \"o\";\n export const LOWER_P: string = \"p\";\n export const LOWER_Q: string = \"q\";\n export const LOWER_R: string = \"r\";\n export const LOWER_S: string = \"s\";\n export const LOWER_T: string = \"t\";\n export const LOWER_U: string = \"u\";\n export const LOWER_V: string = \"v\";\n export const LOWER_W: string = \"w\";\n export const LOWER_X: string = \"x\";\n export const LOWER_Y: string = \"y\";\n export const LOWER_Z: string = \"z\";\n export const UPPER_A: string = \"A\";\n export const UPPER_B: string = \"B\";\n export const UPPER_C: string = \"C\";\n export const UPPER_D: string = \"D\";\n export const UPPER_E: string = \"E\";\n export const UPPER_F: string = \"F\";\n export const UPPER_G: string = \"G\";\n export const UPPER_H: string = \"H\";\n export const UPPER_I: string = \"I\";\n export const UPPER_J: string = \"J\";\n export const UPPER_K: string = \"K\";\n export const UPPER_L: string = \"L\";\n export const UPPER_M: string = \"M\";\n export const UPPER_N: string = \"N\";\n export const UPPER_O: string = \"O\";\n export const UPPER_P: string = \"P\";\n export const UPPER_Q: string = \"Q\";\n export const UPPER_R: string = \"R\";\n export const UPPER_S: string = \"S\";\n export const UPPER_T: string = \"T\";\n export const UPPER_U: string = \"U\";\n export const UPPER_V: string = \"V\";\n export const UPPER_W: string = \"W\";\n export const UPPER_X: string = \"X\";\n export const UPPER_Y: string = \"Y\";\n export const UPPER_Z: string = \"Z\";\n}\nexport namespace KeyboardKeyArrays {\n export const DIGITS: string[] = [ KeyboardKeys.DIGIT_0,\n KeyboardKeys.DIGIT_1,\n KeyboardKeys.DIGIT_2,\n KeyboardKeys.DIGIT_3,\n KeyboardKeys.DIGIT_4,\n KeyboardKeys.DIGIT_5,\n KeyboardKeys.DIGIT_6,\n KeyboardKeys.DIGIT_7,\n KeyboardKeys.DIGIT_8,\n KeyboardKeys.DIGIT_9 ];\n export const UPPER_LETTERS: string[] = [ KeyboardKeys.UPPER_A,\n KeyboardKeys.UPPER_B,\n KeyboardKeys.UPPER_C,\n KeyboardKeys.UPPER_D,\n KeyboardKeys.UPPER_E,\n KeyboardKeys.UPPER_F,\n KeyboardKeys.UPPER_G,\n KeyboardKeys.UPPER_H,\n KeyboardKeys.UPPER_I,\n KeyboardKeys.UPPER_J,\n KeyboardKeys.UPPER_K,\n KeyboardKeys.UPPER_L,\n KeyboardKeys.UPPER_M,\n KeyboardKeys.UPPER_N,\n KeyboardKeys.UPPER_O,\n KeyboardKeys.UPPER_P,\n KeyboardKeys.UPPER_Q,\n KeyboardKeys.UPPER_R,\n KeyboardKeys.UPPER_S,\n KeyboardKeys.UPPER_T,\n KeyboardKeys.UPPER_U,\n KeyboardKeys.UPPER_V,\n KeyboardKeys.UPPER_W,\n KeyboardKeys.UPPER_X,\n KeyboardKeys.UPPER_Y,\n KeyboardKeys.UPPER_Z ];\n export const LOWER_LETTERS: string[] = [ KeyboardKeys.LOWER_A,\n KeyboardKeys.LOWER_B,\n KeyboardKeys.LOWER_C,\n KeyboardKeys.LOWER_D,\n KeyboardKeys.LOWER_E,\n KeyboardKeys.LOWER_F,\n KeyboardKeys.LOWER_G,\n KeyboardKeys.LOWER_H,\n KeyboardKeys.LOWER_I,\n KeyboardKeys.LOWER_J,\n KeyboardKeys.LOWER_K,\n KeyboardKeys.LOWER_L,\n KeyboardKeys.LOWER_M,\n KeyboardKeys.LOWER_N,\n KeyboardKeys.LOWER_O,\n KeyboardKeys.LOWER_P,\n KeyboardKeys.LOWER_Q,\n KeyboardKeys.LOWER_R,\n KeyboardKeys.LOWER_S,\n KeyboardKeys.LOWER_T,\n KeyboardKeys.LOWER_U,\n KeyboardKeys.LOWER_V,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