ChatGPT-Next-Web/app/masks
Lincoln Minto 83e6ff6d96
Refactor: Simplify mask data processing using Object.values and flat
💻 变更类型 | Change Type
feat

🔀 变更说明 | Description of Change
This PR refactors the code handling mask data processing by simplifying the logic and improving scalability and type safety.

Code Enhancements:
Refactored the mask processing logic in app/masks/index.ts:
Replaced manual destructuring of cn, tw, and en keys with Object.values to dynamically handle all mask data.
Used .flat() to simplify merging mask arrays into a single collection.
Added explicit type casting (as BuiltinMask) for improved type safety.

Benefits:
Improved Maintainability: By eliminating hardcoded destructuring, the code can adapt automatically to new mask keys without modification.
Enhanced Readability: The use of Object.values and flat provides a cleaner, more concise approach.
Scalability: The updated implementation supports dynamic mask additions without breaking functionality.

📝 补充信息 | Additional Information
This change ensures the mask processing code is robust and easier to extend in future updates.

Release Notes:

New Features:
Simplified mask data processing using dynamic Object.values and .flat() methods.
Enhanced type safety with explicit type casting (as BuiltinMask).
2025-01-07 09:53:54 -03:00
..
build.ts fix ts 2024-07-03 14:18:22 +08:00
cn.ts 面具“以文搜图”改成“AI文生图”,微调提示让图片生成更稳定无水印 2024-12-13 22:29:14 +08:00
en.ts docs: fix typo in app/masks/en.ts 2023-10-12 21:22:35 +05:45
index.ts Refactor: Simplify mask data processing using Object.values and flat 2025-01-07 09:53:54 -03:00
tw.ts Improve tw Traditional Chinese locale 2024-04-12 00:18:15 +08:00
typing.ts fixup 2023-06-24 00:18:27 +08:00