Skip to content

Commit

Permalink
docs: Add replaceKeys to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavoguichard committed Jun 19, 2024
1 parent 5a29efa commit 7f85122
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ It also only work with common ASCII characters characters. We don't plan to supp
- [delimiterKeys](#delimiterkeys)
- [kebabKeys](#kebabkeys)
- [pascalKeys](#pascalkeys)
- [replaceKeys](#replacekeys)
- [snakeKeys](#snakekeys)
- [Strongly-typed deep transformation of objects](#strongly-typed-deep-transformation-of-objects)
- [deepCamelKeys](#deepcamelkeys)
Expand Down Expand Up @@ -677,6 +678,22 @@ const result = snakeKeys(data)
// ^ { 'hello_world': { 'fooBar': 'baz' } }
```

### replaceKeys

This function shallowly transforms the keys of an object by applying [`replace`](#replace) to each of its keys at both runtime and type levels.

```ts
import { replaceKeys } from 'string-ts'

const data = {
helloWorld: {
fooBar: 'baz',
},
} as const
const result = replaceKeys(data, 'o', 'a')
// ^ { 'hellaWorld': { 'fooBar': 'baz' } }
```

## Strongly-typed deep transformation of objects

### deepCamelKeys
Expand Down

0 comments on commit 7f85122

Please sign in to comment.