@jsheaven/case-converter
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@jsheaven/case-converter

This package provides utility functions for converting strings between various text casing formats in JavaScript/TypeScript. It supports conversion between camelCase, PascalCase, snake_case, and kebab-case. The package can be used to standardize the casing of strings, particularly when dealing with APIs, file names, or data serialization.

User Stories

  1. As a developer, I want to convert strings from one casing format to another.
  2. As a developer, I want to ensure consistency in the casing of strings within my application.
  3. As a developer, I want to have a library that is easy to use and integrates well with my existing codebase.

Features

  • ✅ Supports conversion between camelCase, PascalCase, snake_case, and kebab-case.
  • ✅ Provides functions for both converting strings from one format to another and vice versa.
  • ✅ Lightweight and easy to integrate into existing projects.
  • ✅ Provides TypeScript support with type definitions.
  • ✅ Just 600 byte nano sized (ESM, gizpped)
  • ✅ Tree-shakable and side-effect free
  • ✅ Runs on Windows, Mac, Linux, CI tested
  • ✅ First class TypeScript support
  • ✅ 100% Unit Test coverage

Example Usage

Setup

  • yarn: yarn add @jsheaven/case-converter
  • npm: npm install @jsheaven/case-converter

Usage in JavaScript/TypeScript

import { convert } from '@jsheaven/case-converter'

const inputString = 'hello_world'
const convertedString = convert('SnakeCase', 'CamelCase', inputString)

console.log(convertedString) // Output: helloWorld

CommonJS

const { convert } = require('@jsheaven/case-converter')

const inputString = 'hello_world'
const convertedString = convert('SnakeCase', 'CamelCase', inputString)

console.log(convertedString) // Output: helloWorld

Dependents (0)

Package Sidebar

Install

npm i @jsheaven/case-converter

Weekly Downloads

9

Version

0.0.1

License

MIT

Unpacked Size

45.4 kB

Total Files

9

Last publish

Collaborators

  • mansi1
  • kyr0