Skip to content

Commit 2e7db3e

Browse files
committed
Update README example
1 parent ff92ece commit 2e7db3e

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- [swap-case](https://github.com/blakeembrey/change-case/tree/master/packages/swap-case)
1010
- [title-case](https://github.com/blakeembrey/change-case/tree/master/packages/title-case)
1111

12+
### TypeScript and ESM
13+
14+
All packages are [pure ESM packages](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and ship with TypeScript definitions. They cannot be `require`'d or used with legacy `node` module resolution in TypeScript.
15+
1216
## Related
1317

1418
- [Meteor](https://github.com/Konecty/change-case)

packages/change-case/README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ npm install change-case --save
1010

1111
## Usage
1212

13-
These case change functions are included:
13+
```js
14+
import * as changeCase from "change-case";
15+
16+
changeCase.camelCase("TEST_VALUE"); //=> "testValue"
17+
```
18+
19+
Included case functions:
1420

1521
| Method | Result |
1622
| ----------------- | ----------- |
@@ -27,17 +33,15 @@ These case change functions are included:
2733
| `snakeCase` | `two_words` |
2834
| `trainCase` | `Two-Words` |
2935

30-
All core methods accept [`options`](#options) as the second argument.
31-
32-
### Options
36+
All methods accept an `options` object as the second argument:
3337

3438
- `locale?: string[] | string | false` Lower/upper according to specified locale, defaults to host environment. Set to `false` to disable.
3539
- `separateNumbers?: boolean` Splits `foo123` into `foo 123` instead of keeping them together. Defaults to `true`.
3640
- `prefixCharacters?: string` Retain at the beginning of the string. Defaults to `""`. Example: use `"_"` to keep the underscores in `__typename`.
3741

3842
### Split
3943

40-
**Change case** also exports a `split` function which can be used to build your own case formatting methods. It accepts a string and returns each "word" as an array. For example:
44+
**Change case** exports a `split` utility which can be used to build other case functions. It accepts a string and returns each "word" as an array. For example:
4145

4246
```js
4347
split("fooBar")
@@ -53,11 +57,11 @@ import * as changeKeys from "change-case/keys";
5357
changeKeys.camelCase({ TEST_KEY: true }); //=> { testKey: true }
5458
```
5559

56-
Keys is a wrapper around all case methods to support transforming objects to any case.
60+
**Change case keys** wraps around the core methods to transform object keys to any case.
5761

5862
### API
5963

60-
- **input: unknown** Any JavaScript value.
64+
- **input: any** Any JavaScript value.
6165
- **depth: number** Specify the depth to transfer for case transformation. Defaults to `1`.
6266
- **options: object** Same as base case library.
6367

0 commit comments

Comments
 (0)