Skip to content

Commit 33b5399

Browse files
committed
feat: add copyToClipboard descriptions on README.md
1 parent 6c78d33 commit 33b5399

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const notEmpty = commonUtil.isEmpty("hello"); // false
6666
const nullCheck = commonUtil.isNull(null); // true
6767
const notNull = commonUtil.isNull("hello"); // false
6868
await commonUtil.sleep(1000); // Pauses execution for 1 second
69+
const copied = await commonUtil.copyToClipboard("Hello, World!"); // true if successful
6970

7071
// Cookie utilities
7172
cookieUtil.setCookie("theme", "dark");
@@ -110,6 +111,7 @@ const formattedPhone = formatUtil.formatPhoneNumber("01012345678"); // "010-1234
110111
- `isEmpty(value: unknown): boolean` - Checks if a value is empty (null, undefined, "", 0, [], {}, empty Set/Map, NaN, or invalid Date)
111112
- `isNull(value: unknown): value is null` - Type guard that checks if a value is null and narrows the type
112113
- `sleep(ms: number): Promise<void>` - Pauses execution for a specified number of milliseconds
114+
- `copyToClipboard(text: string): Promise<boolean>` - Copies text to the user's clipboard. Uses modern Clipboard API with fallback to legacy execCommand method. Returns true if successful, false if failed.
113115

114116
### CookieUtil
115117

vitest-report.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<testsuites name="vitest tests" tests="5" failures="0" errors="0" time="0.00308025">
3-
<testsuite name="package/commonUtil/copyToClipboard/index.test.ts" timestamp="2025-09-11T08:31:02.883Z" hostname="users-MacBook-Pro.local" tests="5" failures="0" errors="0" skipped="0" time="0.00308025">
4-
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 성공 케이스 &gt; 최신 Clipboard API를 사용하여 성공적으로 복사한다" time="0.0016125">
2+
<testsuites name="vitest tests" tests="5" failures="0" errors="0" time="0.00300075">
3+
<testsuite name="package/commonUtil/copyToClipboard/index.test.ts" timestamp="2025-09-11T08:34:04.771Z" hostname="users-MacBook-Pro.local" tests="5" failures="0" errors="0" skipped="0" time="0.00300075">
4+
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 성공 케이스 &gt; 최신 Clipboard API를 사용하여 성공적으로 복사한다" time="0.001606541">
55
</testcase>
6-
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 성공 케이스 &gt; Clipboard API 실패 시, 레거시 execCommand 방식으로 대체하여 성공적으로 복사한다" time="0.000355709">
6+
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 성공 케이스 &gt; Clipboard API 실패 시, 레거시 execCommand 방식으로 대체하여 성공적으로 복사한다" time="0.000289792">
77
</testcase>
8-
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 두 가지 방식 모두 실패하면 false를 반환한다" time="0.000178541">
8+
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 두 가지 방식 모두 실패하면 false를 반환한다" time="0.000157542">
99
</testcase>
10-
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 빈 문자열도 성공적으로 복사한다" time="0.000108459">
10+
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 빈 문자열도 성공적으로 복사한다" time="0.000105666">
1111
</testcase>
12-
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 매우 긴 텍스트가 주어지면 에러를 던지고 대체(fallback) 로직으로 복사를 시도한다" time="0.000160834">
12+
<testcase classname="package/commonUtil/copyToClipboard/index.test.ts" name="copyToClipboard &gt; 실패 및 예외 케이스 &gt; 매우 긴 텍스트가 주어지면 에러를 던지고 대체(fallback) 로직으로 복사를 시도한다" time="0.00016025">
1313
</testcase>
1414
</testsuite>
1515
</testsuites>

0 commit comments

Comments
 (0)