Skip to content

Commit 0e6bbea

Browse files
committed
feat: add getDevice descriptions on README.md
1 parent c98cdff commit 0e6bbea

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A comprehensive collection of TypeScript utility functions for modern web develo
44

55
## Features
66

7-
- 🛠️ **Comprehensive**: String, object, cookie, number, validation, format, search query, and common utilities
7+
- 🛠️ **Comprehensive**: String, object, cookie, number, validation, format, search query, device, and common utilities
88
- 📦 **Tree-shakable**: Import only what you need
99
- 🔒 **Type-safe**: Full TypeScript support with type definitions
1010
-**Lightweight**: Minimal dependencies and optimized for performance
@@ -32,6 +32,7 @@ import {
3232
commonUtil,
3333
formatUtil,
3434
searchQueryUtil,
35+
deviceUtil,
3536
} from "kr-corekit";
3637

3738
// String utilities
@@ -72,6 +73,9 @@ const copied = await commonUtil.copyToClipboard("Hello, World!"); // true if suc
7273
// Search Query utilities
7374
const queryParams = searchQueryUtil.getAllQuery(); // { key: ["value1", "value2"], id: "123" }
7475

76+
// Device utilities
77+
const device = deviceUtil.getDevice(); // { isMobile: false, isTablet: false, isDesktop: true, isIOS: false, isAndroid: false }
78+
7579
// Cookie utilities
7680
cookieUtil.setCookie("theme", "dark");
7781
const theme = cookieUtil.getCookie("theme");
@@ -121,6 +125,10 @@ const formattedPhone = formatUtil.formatPhoneNumber("01012345678"); // "010-1234
121125

122126
- `getAllQuery(): Record<string, string | string[]>` - Parses the current URL's query string and returns an object with key-value pairs. Values appear as arrays when the same key is used multiple times.
123127

128+
### DeviceUtil
129+
130+
- `getDevice(): DeviceInfo` - Detects the user's device environment. Returns information about device type (mobile/tablet/desktop) and operating system (iOS/Android). Uses navigator.userAgent for detection and provides safe fallback for SSR environments.
131+
124132
### CookieUtil
125133

126134
- `setCookie(name: string, value: string, options?: object): void` - Sets a cookie

0 commit comments

Comments
 (0)