This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FlatCache } from 'flat-cache'; | |
| export const cache = new FlatCache(); | |
| // =========== | |
| let isInitialRequest = true; | |
| // Utility function to generate a unique cache key | |
| function generateKey(request: Request): string { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define an enum with some color keys and their corresponding values | |
| enum Colors { | |
| Red = "#FF0000", | |
| Green = "#00FF00", | |
| Blue = "#0000FF", | |
| } | |
| // Function to get the value of a color by its key | |
| function getColorValue(colorKey: keyof typeof Colors): string { | |
| return Colors[colorKey]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { defineConfig } from 'vite' | |
| import react from '@vitejs/plugin-react' | |
| import { resolve } from 'path'; | |
| import dts from 'vite-plugin-dts'; | |
| // https://vite.dev/config/ | |
| export default defineConfig({ | |
| plugins: [react(), dts({ | |
| include: ['src/components'], | |
| rollupTypes: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getSafe(fn) { | |
| try { | |
| return fn(); | |
| } catch (e) { | |
| return undefined; | |
| } | |
| } | |
| /** | |
| * Safely retrieves a value from an object at the specified path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function encryptData(data, key) { | |
| const encodedData = new TextEncoder().encode(data); | |
| const iv = crypto.getRandomValues(new Uint8Array(12)); // Initialization vector | |
| const encryptedData = await crypto.subtle.encrypt( | |
| { | |
| name: "AES-GCM", | |
| iv: iv | |
| }, | |
| key, | |
| encodedData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getEnvVariable(key: string): string { | |
| if (key === undefined) { | |
| throw Error(`"${key}" is undefined`); | |
| } | |
| const value = process.env[key]; | |
| if (!value) { | |
| throw Error( | |
| `Environment variable "${key}" does not exist on process.env` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "Component": { | |
| "prefix": "mkComponent", | |
| "body": [ | |
| "import React, { type ReactNode } from 'react';", | |
| "", | |
| "interface ${TM_FILENAME_BASE/(.*)\\..+$/$1/}Props {", | |
| " children: ReactNode;", | |
| "}", | |
| "", |
NewerOlder