A collection of Cloudflare Workers-compatible utility functions for Go Corp projects. Node.js utilities available via @go-corp/utils/node.
npm install @go-corp/utils





A comprehensive collection of utility functions for TypeScript/JavaScript projects.
``bash`
npm install @go-corp/utilsor
yarn add @go-corp/utilsor
bun add @go-corp/utils
`typescript
import { deepClone, formatDate, toCamelCase } from '@go-corp/utils'
// String utilities
const camelCased = toCamelCase('hello world') // 'helloWorld'
// Date utilities
const formatted = formatDate(new Date(), 'medium') // 'Jan 1, 2024'
// Object utilities
const cloned = deepClone({ a: { b: 1 } })
`
- toCamelCase(str: string): string - Converts string to camelCasetoKebabCase(str: string): string
- - Converts string to kebab-casetoSnakeCase(str: string): string
- - Converts string to snake_casetoPascalCase(str: string): string
- - Converts string to PascalCasetruncate(str: string, length: number, suffix?: string): string
- - Truncates string to specified lengthcapitalize(str: string): string
- - Capitalizes first letterslugify(str: string): string
- - Creates URL-friendly slugsgenerateRandomString(length: number, charset?: string): string
- - Generates random stringremoveWhitespace(str: string): string
- - Removes all whitespace
- formatDate(date: Date, format?: 'short' | 'medium' | 'long' | 'iso'): string - Formats datedaysBetween(date1: Date, date2: Date): number
- - Days between two datesisToday(date: Date): boolean
- - Checks if date is todayisThisWeek(date: Date): boolean
- - Checks if date is this weekaddDays(date: Date, days: number): Date
- - Adds days to dateaddMonths(date: Date, months: number): Date
- - Adds months to datestartOfDay(date: Date): Date
- - Gets start of dayendOfDay(date: Date): Date
- - Gets end of daygetRelativeTime(date: Date, baseDate?: Date): string
- - Gets relative time string
- deepClone - Deep clones objectomit
- - Omits keys from objectpick
- - Picks keys from objectisEmpty(obj: any): boolean
- - Checks if object is empty
- unique - Removes duplicate valuesgroupBy
- - Groups array items by keychunk
- - Chunks array into smaller arraysshuffle
- - Shuffles array randomly
- isValidEmail(email: string): boolean - Validates email addressisValidUrl(url: string): boolean
- - Validates URLisValidPhone(phone: string): boolean
- - Validates phone number (US format)isValidUUID(uuid: string): boolean
- - Validates UUID
- delay(ms: number): Promise - Creates a delay/sleep functiondebounce
- - Debounces functionthrottle
- - Throttles functionretry
- - Retries async function with exponential backoff
- isNotNull - Type guard for non-null valuesisString(value: unknown): value is string
- - Type guard for stringsisNumber(value: unknown): value is number
- - Type guard for numbersisBoolean(value: unknown): value is boolean
- - Type guard for booleansisArray
- - Type guard for arraysisObject(value: unknown): value is Record
- - Type guard for plain objectsisFunction(value: unknown): value is Function
- - Type guard for functions
- clamp(value: number, min: number, max: number): number - Clamps number between min/maxrandomBetween(min: number, max: number): number
- - Random number between min/maxroundTo(value: number, decimals: number): number
- - Rounds to specified decimalspercentage(value: number, total: number): number
- - Calculates percentagedegToRad(degrees: number): number
- - Converts degrees to radiansradToDeg(radians: number): number
- - Converts radians to degrees
- getQueryParams(url: string): Record - Gets URL query parametersformatBytes(bytes: number, decimals?: number): string
- - Formats bytes to human readablecopyToClipboard(text: string): Promise
- - Copies text to clipboard
- createTimer(label?: string) - Creates a performance timerlogWithTime(message: string, ...args: any[]): void
- - Logs with timestampprettyPrint(obj: any, indent?: number): void
- - Pretty prints objectmeasureTime
- - Measures function execution time
#### Git & Repository Management
- getCurrentBranch(): string - Get current Git branchhasUncommittedChanges(): boolean
- - Check for uncommitted changesgetChangedFiles(): string[]
- - Get list of changed filesgetRecentCommits(count?: number): string[]
- - Get recent commit messagesincrementVersion(version: string, type: 'major' | 'minor' | 'patch'): string
- - Increment version stringgetCurrentVersion(packagePath?: string): string
- - Get version from package.jsonupdatePackageVersion(newVersion: string, packagePath?: string): void
- - Update package.json versionanalyzeChangesForVersionBump(): VersionAnalysis
- - Analyze changes for version bumpupdateChangelog(version: string, changeType: string, changesList: string[]): void
- - Update CHANGELOG.mdcommitAndPush(message: string, push?: boolean): void
- - Create and push git commitisGitRepository(): boolean
- - Check if in a git repositoryexec(command: string, options?: ExecOptions): string
- - Execute shell commandlog(message: string, color?: string): void
- - Log with colorCOLORS
- - Terminal color constants
#### CLI Prompts & Interaction
- text(options: PromptOptions): Promise - Simple text promptconfirm(options: ConfirmOptions): Promise
- - Yes/no confirmationselect
- - Select from optionsmultiselect
- - Multi-select from optionspassword(options: PromptOptions): Promise
- - Hidden password inputProgressIndicator
- - Animated progress indicator class
`bashInstall dependencies
bun install
MCP Server Integration
@go-corp/utils includes an MCP (Model Context Protocol) server that automatically provides AI assistants with context about your utilities.
$3
1. Install the package:
`bash
npm install @go-corp/utils
`2. Configure Warp MCP in your terminal settings:
`json
{
"mcpServers": {
"go-utils": {
"command": "go-utils-mcp"
}
}
}
`3. The AI will now automatically know when
@go-corp/utils is available and suggest relevant utilities!$3
- ✅ Which utilities are available in your project
- 📋 Detailed function signatures and usage examples
- 🎯 When to suggest specific utilities
- 🚀 Import statements and code examples
- 💡 Perfect use cases for different scenariosSee
mcp-server/README.md for detailed setup instructions.Contributing
1. Fork the repository
2. Create your feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add some amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)MIT © Go Corp