# uncase

> Wrapper of change-case to create case converter, validator and etc.

Latest version **0.3.0** (published 2026-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install uncase
pnpm add uncase
yarn add uncase
bun add uncase
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2026-07-28 |
| First published | 2025-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | ntnyq |
| Maintainers | ntnyq |
| Keywords | camelCase, capitalCase, change-case, constantCase, converter, dotCase, kebabCase, noCase, pascalCase, pascalSnakeCase, pathCase, sentenceCase, snakeCase, trainCase, validate |

## Links

- npm: https://www.npmjs.com/package/uncase
- Repository: ntnyq/uncase
- Homepage: https://github.com/ntnyq/uncase#readme
- Issues: https://github.com/ntnyq/uncase/issues
- npm.io page: https://npm.io/package/uncase

## Dependencies (1)

- [change-case](https://npm.io/package/change-case.md) ^5.4.4

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.3.0 (latest) — 2026-07-28
- 0.2.0 — 2025-08-19
- 0.1.0 — 2025-04-16
- 0.0.4 — 2025-02-17
- 0.0.3 — 2025-02-14
- 0.0.2 — 2025-02-14
- 0.0.1 — 2025-02-14

## README

# uncase

[![CI](https://github.com/ntnyq/uncase/workflows/CI/badge.svg)](https://github.com/ntnyq/uncase/actions)
[![NPM VERSION](https://img.shields.io/npm/v/uncase.svg)](https://www.npmjs.com/package/uncase)
[![NPM DOWNLOADS](https://img.shields.io/npm/dy/uncase.svg)](https://www.npmjs.com/package/uncase)
[![CODECOV](https://codecov.io/github/ntnyq/uncase/branch/main/graph/badge.svg?token=YGDMMEUY4M)](https://codecov.io/github/ntnyq/uncase)
[![LICENSE](https://img.shields.io/github/license/ntnyq/uncase.svg)](https://github.com/ntnyq/uncase/blob/main/LICENSE)

Wrapper of [change-case](https://github.com/blakeembrey/change-case) to create case converter, validator and etc.

## Install

```shell
npm install uncase
```

```shell
yarn add uncase
```

```shell
pnpm add uncase
```

## Usage

### case converter

```ts
import { getCaseConverter } from 'uncase'

const result = getCaseConverter('camelCase')('hello-world')

console.log(result)
// => { input: 'hello-world', changed: true, output: 'helloWorld' }
```

### case validator

```ts
import { isCamelCase, isPascalCase } from 'uncase/is'

console.log(isCamelCase('hello-world'))
// => false

console.log(isPascalCase('HelloWorld'))
// => true
```

## API

### Case converter

#### `getCaseConverter`

- **Type**: `(caseType: CaseType, options: Options = {}) => CaseConverter`

Get a converter by caseType and convert the given input.

#### Interface

```ts
/**
 * Case converter
 */
export type CaseConverter = (input: string) => CaseConvertResult

/**
 * Case convert result
 */
export type CaseConvertResult = {
  /**
   * whether output has changed from input
   */
  changed: boolean

  /**
   * input value
   */
  input: string

  /**
   * converted value
   */
  output: string
}

/**
 * All case converter names in raw and `camelCase`
 */
export type CaseType =
  | 'camelCase'
  | 'capitalCase'
  | 'Capital Case'
  | 'CONSTANT_CASE'
  | 'constantCase'
  | 'dot.case'
  | 'dotCase'
  | 'kebab-case'
  | 'kebabCase'
  | 'noCase'
  | 'no case'
  | 'Pascal_Snake_Case'
  | 'pascalCase'
  | 'PascalCase'
  | 'pascalSnakeCase'
  | 'path/case'
  | 'pathCase'
  | 'sentenceCase'
  | 'Sentence case'
  | 'snake_case'
  | 'snakeCase'
  | 'Train-Case'
  | 'trainCase'
```

### Case validator

- `isCamelCase`
- `isCapitalCase`
- `isConstantCase`
- `isDotCase`
- `isKebabCase`
- `isNoCase`
- `isPascalCase`
- `isPascalSnakeCase`
- `isPathCase`
- `isSentenceCase`
- `isSnakeCase`
- `isTrainCase`

#### Type

```ts
export type CaseValidator = (input: string) => boolean
```

## Why this?

Dynamic case convert. Useful to create ESLint case convention rules.

## Credits

- [change-case](https://github.com/blakeembrey/change-case)

## License

[MIT](./LICENSE) License © 2025-PRESENT [ntnyq](https://github.com/ntnyq)

---
_Source: https://npm.io/package/uncase · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
