npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@shubham-tech/case-converter

v1.0.0

Published

Ultra-lean and fast CLI tool for converting text to various case formats

Downloads

3

Readme

Case Converter

npm version License: MIT

An ultra-lean and fast CLI tool for converting text to various case formats. Built with TypeScript and optimised for performance whilst maintaining readability.

Features

  • 5 Case Conversion Types: Sentence case, lowercase, UPPERCASE, Title Case, and tOGGLE cASE
  • Multiple Input Methods: Command-line arguments or stdin
  • High Performance: Optimised for speed with large text inputs
  • Comprehensive Error Handling: Robust handling of edge cases and invalid inputs
  • Unicode Support: Works with international characters, emojis, and special symbols
  • Zero Dependencies: Lightweight with no external runtime dependencies
  • Global Installation: Can be run from any directory after installation

Installation

Global Installation (Recommended)

npm install -g case-converter

Local Installation

npm install case-converter

From Source

git clone https://github.com/Sharma-IT/case-converter.git
cd case-converter
npm install
npm run build
npm link

Usage

Command Line Arguments

# Convert text provided as arguments
case-converter "hello WORLD"
case-converter hello beautiful WORLD

# Show help
case-converter --help
case-converter -h

# Show version
case-converter --version
case-converter -v

Stdin Input

# Pipe text from other commands
echo "hello WORLD" | case-converter

# Read from file
cat myfile.txt | case-converter

# Interactive input (type text and press Ctrl+D)
case-converter

Output Format

Input: hello WORLD

Sentence case: Hello world
lowercase: hello world
UPPERCASE: HELLO WORLD
Title Case: Hello World
tOGGLE cASE: HELLO world

Case Conversion Types

| Type | Description | Example Input | Example Output | |------|-------------|---------------|----------------| | Sentence case | First letter capitalised, rest lowercase | hello WORLD | Hello world | | lowercase | All letters in lowercase | Hello WORLD | hello world | | UPPERCASE | All letters in uppercase | hello world | HELLO WORLD | | Title Case | First letter of each word capitalised | hello world | Hello World | | tOGGLE cASE | Invert the case of each letter | Hello World | hELLO wORLD |

Advanced Examples

Working with Special Characters

case-converter "café naïve"
# Output includes proper handling of accented characters

case-converter "[email protected]"
# Handles email addresses and special characters

case-converter "version-1.2.3"
# Works with version strings and hyphens

Working with Unicode

case-converter "Hello 世界 WORLD"
# Supports mixed scripts and Unicode characters

case-converter "hello 🌍 WORLD!"
# Handles emojis and symbols correctly

Performance with Large Inputs

# The tool efficiently handles large text files
cat large-document.txt | case-converter

# Works with very long strings
case-converter "$(cat /usr/share/dict/words | head -1000 | tr '\n' ' ')"

Development

Prerequisites

  • Node.js 14.0.0 or higher
  • npm or yarn

Setup

# Clone the repository
git clone https://github.com/Sharma-IT/case-converter.git
cd case-converter

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Watch mode for development
npm run dev

Project Structure

case-converter/
├── src/
│   ├── types.ts          # TypeScript type definitions
│   ├── converters.ts     # Core case conversion functions
│   ├── cli.ts           # CLI interface and argument parsing
│   ├── index.ts         # Main entry point
│   └── *.test.ts        # Test files
├── dist/                # Compiled JavaScript files
├── coverage/            # Test coverage reports
├── package.json         # Package configuration
├── tsconfig.json        # TypeScript configuration
├── jest.config.js       # Jest test configuration
└── README.md           # This file

Testing

The project follows test-driven development (TDD) principles with comprehensive test coverage:

# Run all tests
npm test

# Run specific test file
npm test -- src/converters.test.ts

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

Scripts

| Script | Description | |--------|-------------| | npm run build | Compile TypeScript to JavaScript | | npm test | Run all tests | | npm run test:watch | Run tests in watch mode | | npm run test:coverage | Run tests with coverage report | | npm run dev | Watch mode for development | | npm run lint | TypeScript compilation check | | npm start | Run the CLI tool |

API

Programmatic Usage

You can also use the case converter functions programmatically:

import { 
  toSentenceCase, 
  toLowerCase, 
  toUpperCase, 
  toTitleCase, 
  toToggleCase,
  getCaseConverters 
} from 'case-converter';

// Individual functions
const sentence = toSentenceCase('hello WORLD'); // "Hello world"
const lower = toLowerCase('Hello WORLD');       // "hello world"
const upper = toUpperCase('hello world');       // "HELLO WORLD"
const title = toTitleCase('hello world');       // "Hello World"
const toggle = toToggleCase('Hello World');     // "hELLO wORLD"

// Get all converters
const converters = getCaseConverters();
const results = Object.entries(converters).map(([type, converter]) => ({
  type,
  result: converter('hello WORLD')
}));

Error Handling

The tool provides comprehensive error handling for various scenarios:

  • Empty Input: Clear error message when no input is provided
  • Invalid Arguments: Helpful usage information for incorrect usage
  • Large Inputs: Performance warnings for very large text inputs
  • Unicode Edge Cases: Graceful handling of special Unicode characters
  • System Errors: Proper error reporting for file system or stdin issues

Performance

  • Optimised Algorithms: Efficient string manipulation algorithms
  • Memory Management: Minimal memory footprint with proper cleanup
  • Large Input Handling: Can process files with millions of characters
  • Concurrent Processing: Supports multiple simultaneous conversions

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following the existing code style
  4. Add tests for new functionality
  5. Ensure all tests pass (npm test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Shubham Sharma

Changelog

v1.0.0

  • Initial release
  • Support for 5 case conversion types
  • CLI interface with argument and stdin support
  • Comprehensive test suite
  • Unicode and international character support
  • Performance optimisations
  • Error handling and edge case management