# snake-camel-types

> Utility type definition convert snake_case🐍 ←→ camelCase🐪

Latest version **1.0.1** (published 2022-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install snake-camel-types
pnpm add snake-camel-types
yarn add snake-camel-types
bun add snake-camel-types
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-02-13 |
| First published | 2022-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | kazuwombat |
| Maintainers | kazuwombat |

## Links

- npm: https://www.npmjs.com/package/snake-camel-types
- Repository: https://github.com/kazuooooo/snake-camel-types
- Homepage: https://github.com/kazuooooo/snake-camel-types#readme
- Issues: https://github.com/kazuooooo/snake-camel-types/issues
- npm.io page: https://npm.io/package/snake-camel-types

## Recent versions

- 1.0.1 (latest) — 2022-02-13
- 1.0.0 — 2022-02-13

## README

# snake-camel-types
Utility type definition convert snake_case🐍 ←→ camelCase🐪

## Installation

```sh
npm install snake-camel-types --save-dev
or
yarn add -D snake-camel-types
```

## Usage

### SnakeToCamelCase(🐍→🐪)
Convert single key from snake_case to camelCase
```typescript
import { SnakeToCamelCase } from "snake-camel-types"
type CamelUserId = SnakeToCamelCase<'user_id'>
// => 'userId'
```

### SnakeToCamel(🐍→🐪)
Convert snake_case key object to camelCase key object
```typescript
import { SnakeToCamel } from "snake-camel-types"
type SnakeUser = {
  user_id: string,
  birth_year: number
  is_married: boolean,
}
 
type CamelUser = SnakeToCamel<SnakeUser>
// type CamelUser = {
//   userId: string;
//   birthYear: number;
//   isMarried: boolean;
// }
```

### CamelToSnakeCase(🐪→🐍)
Convert single key from camelCase to snake_case
```typescript
import { CamelToSnakeCase } from "snake-camel-types"
type SnakeUserId = CamelToSnakeCase<'userId'>
// => 'user_id'
```
### CamelToSnake(🐪→🐍)
```typescript
import { CamelToSnake } from "snake-camel-types"
type CamelUser = {
  userId: string,
  birthYear: number
  isMarried: boolean,
}
type SnakeUser = CamelToSnake<CamelUser>
// type SnakeUser = {
//   user_id: string;
//   birth_year: number;
//   is_married: boolean;
// }
```

## License

[MIT](http://opensource.org/licenses/MIT)

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