caseparser 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +26 -24
- package/package.json +1 -1
- package/.editorconfig +0 -12
- package/.prettierrc +0 -8
- package/playground.ts +0 -9
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
# [CaseParser](https://github.com/NandoMB/caseparser)
|
|
2
|
-
Convert **Strings** and **JSON (Object Keys)** from a
|
|
1
|
+
# [CaseParser 2](https://github.com/NandoMB/caseparser)
|
|
2
|
+
Convert **Strings** and **JSON (Object Keys)** from a **case type** to another one.
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
######
|
|
6
|
-
> This is the version 2.x.x that supports Typescript
|
|
5
|
+
###### Note:
|
|
6
|
+
> This is the **version 2.x.x** that supports **Typescript**. If you're looking for version 1.x.x, [click here](https://github.com/NandoMB/caseparser/tree/v1.x.x) to see the docs.
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
+
###### Yarn
|
|
11
12
|
```sh
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
yarn add caseparser
|
|
14
|
+
```
|
|
15
|
+
###### NPM
|
|
16
|
+
```sh
|
|
17
|
+
npm add caseparser
|
|
18
|
+
```
|
|
19
|
+
###### PNPM
|
|
20
|
+
```sh
|
|
21
|
+
pnpm add caseparser
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
##
|
|
24
|
+
## Conversion Types
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
###### camelCase to ...
|
|
26
27
|
```js
|
|
27
28
|
caseparser.camelToDash(data);
|
|
28
29
|
caseparser.camelToPascal(data);
|
|
@@ -30,7 +31,7 @@ caseparser.camelToSnake(data);
|
|
|
30
31
|
caseparser.camelToUpperDash(data);
|
|
31
32
|
caseparser.camelToUpperSnake(data);
|
|
32
33
|
```
|
|
33
|
-
|
|
34
|
+
###### snakeCase to ...
|
|
34
35
|
```js
|
|
35
36
|
caseparser.snakeToCamel(data);
|
|
36
37
|
caseparser.snakeToDash(data);
|
|
@@ -38,7 +39,7 @@ caseparser.snakeToPascal(data);
|
|
|
38
39
|
caseparser.snakeToUpperDash(data);
|
|
39
40
|
caseparser.snakeToUpperSnake(data);
|
|
40
41
|
```
|
|
41
|
-
|
|
42
|
+
###### dashCase to ...
|
|
42
43
|
```js
|
|
43
44
|
caseparser.dashToCamel(data);
|
|
44
45
|
caseparser.dashToPascal(data);
|
|
@@ -46,7 +47,7 @@ caseparser.dashToSnake(data);
|
|
|
46
47
|
caseparser.dashToUpperDash(data);
|
|
47
48
|
caseparser.dashToUpperSnake(data);
|
|
48
49
|
```
|
|
49
|
-
|
|
50
|
+
###### pascalCase to ...
|
|
50
51
|
```js
|
|
51
52
|
caseparser.pascalToCamel(data);
|
|
52
53
|
caseparser.pascalToDash(data);
|
|
@@ -54,7 +55,7 @@ caseparser.pascalToSnake(data);
|
|
|
54
55
|
caseparser.pascalToUpperDash(data);
|
|
55
56
|
caseparser.pascalToUpperSnake(data);
|
|
56
57
|
```
|
|
57
|
-
|
|
58
|
+
###### upperSnakeCase to ...
|
|
58
59
|
```js
|
|
59
60
|
caseparser.upperSnakeToCamel(data);
|
|
60
61
|
caseparser.upperSnakeToDash(data);
|
|
@@ -62,7 +63,7 @@ caseparser.upperSnakeToPascal(data);
|
|
|
62
63
|
caseparser.upperSnakeToSnake(data);
|
|
63
64
|
caseparser.upperSnakeToUpperDash(data);
|
|
64
65
|
```
|
|
65
|
-
|
|
66
|
+
###### upperDashCase to ...
|
|
66
67
|
```js
|
|
67
68
|
caseparser.upperDashToCamel(data);
|
|
68
69
|
caseparser.upperDashToDash(data);
|
|
@@ -76,7 +77,7 @@ caseparser.upperDashToUpperSnake(data);
|
|
|
76
77
|
## How to use
|
|
77
78
|
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
###### Example 1
|
|
80
81
|
Passing **String** as parameter:
|
|
81
82
|
```ts
|
|
82
83
|
import caseparser from 'caseparser';
|
|
@@ -87,8 +88,9 @@ Will result:
|
|
|
87
88
|
```json
|
|
88
89
|
'lorem_ipsum_is_simply_dummy_text_of_the_printing_and_typesetting_industry'
|
|
89
90
|
```
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
<br/>
|
|
92
|
+
|
|
93
|
+
###### Example 2
|
|
92
94
|
Passing **JSON** as parameter:
|
|
93
95
|
```js
|
|
94
96
|
import caseparser from 'caseparser';
|
|
@@ -115,7 +117,7 @@ const data = [
|
|
|
115
117
|
];
|
|
116
118
|
const result = caseparser.camelToSnake(data);
|
|
117
119
|
```
|
|
118
|
-
Result:
|
|
120
|
+
Will Result:
|
|
119
121
|
```json
|
|
120
122
|
[
|
|
121
123
|
{
|
package/package.json
CHANGED
package/.editorconfig
DELETED
package/.prettierrc
DELETED
package/playground.ts
DELETED