Skip to content

Playground

Experience JavaScript Utils functions online without installation.

🚀 Quick Start

Click the button below to open the online demo environment with real-time editing and execution:

💻 Local Demo

You can also run the demo locally:

bash
# Clone the project
git clone https://github.com/toFrankie/utils.git
cd utils

# Install dependencies
pnpm install

# Run local demos
pnpm dev:array    # Array utilities demo
pnpm dev:object   # Object utilities demo
pnpm dev:string   # String utilities demo
pnpm dev:validation # Validation utilities demo

📚 Function Categories

Choose the functions you want to experience:

Function Utils

  • Debounce - Delay function execution until after specified time
  • Throttle - Limit function execution frequency
  • Delay - Delay function execution

Array Utils

Object Utils

String Utils

Validation Utils

Online Editor

🎮 Interactive Playground

📚 Version Information

  • Latest: Contains all the latest features and fixes
  • Stable: Well-tested stable version
  • Beta: Preview version with experimental features

Local Development

You can also run examples locally:

bash
# Run ESM examples
pnpm dev:examples

# Or run directly
node examples/esm-demo.mjs
node examples/node-demo.cjs

Example Code

Debounce Example

javascript
import { debounce } from '@tofrankie/utils'

const debouncedFn = debounce(() => {
  console.log('Debounced execution')
}, 300)

// Multiple rapid calls, only the last one executes after 300ms
debouncedFn()
debouncedFn()
debouncedFn() // Only this one will execute

Throttle Example

javascript
import { throttle } from '@tofrankie/utils'

const throttledFn = throttle(() => {
  console.log('Throttled execution')
}, 300)

// Multiple calls within 300ms, only one executes
throttledFn()
throttledFn() // Ignored
throttledFn() // Ignored

Delay Example

javascript
import { delay } from '@tofrankie/utils'

const delayedFn = delay(() => {
  console.log('Delayed execution')
}, 1000)

// Executes after 1 second
delayedFn()

基于 MIT 许可发布