Skip to content

Instantly share code, notes, and snippets.

@ralekna
ralekna / camelCase.ts
Created December 12, 2025 07:51 — forked from rytis-simplex/camelCase.ts
A TypeScript funtion to convert kebab-case or SNAKE_CASE string to CamelCase
export const toCamelCase = (str: string, firstLowerCase = true): string =>
str
.split(/(?=(?:(?<![A-Z])[A-Z])|(?:(?<!\d)\d))|[-_]/)
.map(
([first, ...rest], index) =>
(firstLowerCase && index === 0
? first.toLowerCase()
: first.toUpperCase()) + rest.join("").toLowerCase()
)
.join("");
#!/bin/bash
# Form from https://gist.github.com/robwierzbowski/5430952/
# Create a remote repo on GitHub and clone it to your computer
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Get user input
echo "New repo name:"
read REPONAME