بازساخت کد به یک الگوی مشخص
وقتی میدانید الگوی هدف چیست (Strategy، Result، Observer …) ولی نمیخواهید دستی بازنویسی کنید.
TS
وقتی میدانید الگوی هدف چیست (Strategy، Result، Observer …) ولی نمیخواهید دستی بازنویسی کنید.
Refactor the code below to use the [pattern name] pattern. Constraints: - Public API of the module must not change. - All tests in [test file path] must still pass. - Add brief inline comments only where the pattern is non-obvious to a reader who doesn't know it. - Show the diff first, then a 3-line summary of why the refactor is worth it. Original: ``` [paste code] ```
این پرامپت از ۳ متغیر استفاده میکند. مقدار هر متغیر را با دادهٔ خودتان جایگزین کنید:
[pattern name]— مقدار دلخواه خود را جایگزین کنید[test file path]— مقدار دلخواه خود را جایگزین کنید[paste code]— مقدار دلخواه خود را جایگزین کنیداین پرامپت برای مدلهای زیر تست و بهینهسازی شده است: