API Reference
Complete API documentation for JavaScript Utils functions.
Function Categories
Function Utils
- debounce - Delay function execution until after wait time has elapsed
- throttle - Limit function execution frequency
- delay - Delay function execution
Array Utils
- isArray - Check if value is an array
- chunk - Split array into chunks of specified size
- unique - Remove duplicates from array
Object Utils
- deepCopy - Deep clone objects
- pick - Pick specified properties from object
- omit - Omit specified properties from object
String Utils
- convert2pinyin - Convert Chinese characters to pinyin
- capitalize - Capitalize first letter of string
- camelCase - Convert string to camelCase
Validation Utils
- checkIdNumber - Validate Chinese ID number
- isEmail - Validate email address
- isPhone - Validate phone number
Import Methods
typescript
import { debounce, throttle } from '@tofrankie/utils'TypeScript Support
JavaScript Utils is built with TypeScript and provides complete type definitions:
typescript
import { debounce } from '@tofrankie/utils'
// TypeScript knows the exact type
const debouncedFn: (...args: any[]) => void = debounce(() => {
console.log('Hello')
}, 300)Bundle Size
Each function is optimized for minimal bundle size:
- debounce: ~0.5KB
- throttle: ~0.5KB
- isArray: ~0.2KB
- deepCopy: ~0.4KB
- convert2pinyin: ~0.3KB
Quick Links
- Getting Started - Learn how to use JavaScript Utils
- Examples - Practical usage examples
- Playground - Try functions online