mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-24 03:32:58 +03:00
docs(pascalCase, startCase): Add docs for pascalCase & startCase
This commit is contained in:
parent
6d84ac35a4
commit
5d34b16683
@ -197,6 +197,7 @@ function sidebar(): DefaultTheme.Sidebar {
|
||||
{ text: 'kebabCase', link: '/reference/string/kebabCase' },
|
||||
{ text: 'lowerCase', link: '/reference/string/lowerCase' },
|
||||
{ text: 'startCase', link: '/reference/string/startCase' },
|
||||
{ text: 'pascalCase', link: '/reference/string/pascalCase' },
|
||||
{ text: 'capitalize', link: '/reference/string/capitalize' },
|
||||
{ text: 'startsWith (compat)', link: '/reference/compat/string/startsWith' },
|
||||
{ text: 'endsWith (compat)', link: '/reference/compat/string/endsWith' },
|
||||
|
@ -210,6 +210,7 @@ function sidebar(): DefaultTheme.Sidebar {
|
||||
{ text: 'kebabCase', link: '/ko/reference/string/kebabCase' },
|
||||
{ text: 'lowerCase', link: '/ko/reference/string/lowerCase' },
|
||||
{ text: 'startCase', link: '/ko/reference/string/startCase' },
|
||||
{ text: 'pascalCase', link: '/ko/reference/string/pascalCase' },
|
||||
{ text: 'capitalize', link: '/ko/reference/string/capitalize' },
|
||||
{ text: 'startsWith (호환성)', link: '/ko/reference/compat/string/startsWith' },
|
||||
{ text: 'endsWith (호환성)', link: '/ko/reference/compat/string/endsWith' },
|
||||
|
@ -191,6 +191,8 @@ function sidebar(): DefaultTheme.Sidebar {
|
||||
{ text: 'snakeCase', link: '/zh_hans/reference/string/snakeCase' },
|
||||
{ text: 'kebabCase', link: '/zh_hans/reference/string/kebabCase' },
|
||||
{ text: 'lowerCase', link: '/zh_hans/reference/string/lowerCase' },
|
||||
{ text: 'startCase', link: '/zh_hans/reference/string/startCase' },
|
||||
{ text: 'pascalCase', link: '/zh_hans/reference/string/pascalCase' },
|
||||
{ text: 'capitalize', link: '/zh_hans/reference/string/capitalize' },
|
||||
{ text: 'startsWith (兼容性)', link: '/zh_hans/reference/compat/string/startsWith' },
|
||||
{ text: 'endsWith (兼容性)', link: '/zh_hans/reference/compat/string/endsWith' },
|
||||
|
42
docs/ko/reference/string/pascalCase.md
Normal file
42
docs/ko/reference/string/pascalCase.md
Normal file
@ -0,0 +1,42 @@
|
||||
# pascalCase
|
||||
|
||||
문자열을 파스칼 표기법으로 변환해요.
|
||||
|
||||
파스칼 표기법은 여러 단어로 구성된 식별자의 각 단어의 첫 문자를 [대문자](./capitalize.md)로 연결하는 표기법이에요. 예를 들어 `PascalCase`처럼 써요.
|
||||
|
||||
## 인터페이스
|
||||
|
||||
```typescript
|
||||
function pascalCase(str: string): string;
|
||||
```
|
||||
|
||||
### 파라미터
|
||||
|
||||
- `str` (`string`): 파스칼 표기법으로 변환할 문자열.
|
||||
|
||||
### 반환 값
|
||||
|
||||
(`string`): 파스칼 표기법으로 변환된 문자열.
|
||||
|
||||
## 예시
|
||||
|
||||
```typescript
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
const convertedStr1 = pascalCase('pascalCase'); // returns 'PascalCase'
|
||||
const convertedStr2 = pascalCase('some whitespace'); // returns 'SomeWhitespace'
|
||||
const convertedStr3 = pascalCase('hyphen-text'); // returns 'HyphenText'
|
||||
const convertedStr4 = pascalCase('HTTPRequest'); // returns 'HttpRequest'
|
||||
```
|
||||
|
||||
## 데모
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(pascalCase('pascalCase'));
|
||||
```
|
||||
|
||||
:::
|
@ -32,3 +32,15 @@ startCase('__abc__123__def__'); // returns 'Abc 123 Def'
|
||||
startCase('_-_-_-_'); // returns ''
|
||||
startCase('12abc 12ABC'); // returns '12 Abc 12 ABC'
|
||||
```
|
||||
|
||||
## 데모
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { startCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(startCase('startCase'));
|
||||
```
|
||||
|
||||
:::
|
||||
|
42
docs/reference/string/pascalCase.md
Normal file
42
docs/reference/string/pascalCase.md
Normal file
@ -0,0 +1,42 @@
|
||||
# pascalCase
|
||||
|
||||
Converts a string to Pascal case.
|
||||
|
||||
Pascal case is the naming convention in which each word is capitalized and concatenated without any separator characters. For example, `PascalCase`.
|
||||
|
||||
## Signature
|
||||
|
||||
```typescript
|
||||
function pascalCase(str: string): string;
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
- `str` (`string`): The string that is to be changed to Pascal case.
|
||||
|
||||
### Returns
|
||||
|
||||
(`string`) The converted string to Pascal case.
|
||||
|
||||
## Examples
|
||||
|
||||
```typescript
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
const convertedStr1 = pascalCase('pascalCase'); // returns 'PascalCase'
|
||||
const convertedStr2 = pascalCase('some whitespace'); // returns 'SomeWhitespace'
|
||||
const convertedStr3 = pascalCase('hyphen-text'); // returns 'HyphenText'
|
||||
const convertedStr4 = pascalCase('HTTPRequest'); // returns 'HttpRequest'
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(pascalCase('pascalCase'));
|
||||
```
|
||||
|
||||
:::
|
@ -32,3 +32,15 @@ startCase('__abc__123__def__'); // returns 'Abc 123 Def'
|
||||
startCase('_-_-_-_'); // returns ''
|
||||
startCase('12abc 12ABC'); // returns '12 Abc 12 ABC'
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { startCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(startCase('startCase'));
|
||||
```
|
||||
|
||||
:::
|
||||
|
42
docs/zh_hans/reference/string/pascalCase.md
Normal file
42
docs/zh_hans/reference/string/pascalCase.md
Normal file
@ -0,0 +1,42 @@
|
||||
# pascalCase
|
||||
|
||||
将字符串转换为 Pascal 大小写。
|
||||
|
||||
Pascal 大小写是一种命名约定,其中每个单词都被大写并且没有任何分隔符字符。例如,`PascalCase`。
|
||||
|
||||
## 签名
|
||||
|
||||
```typescript
|
||||
function pascalCase(str: string): string;
|
||||
```
|
||||
|
||||
### 参数
|
||||
|
||||
- `str` (`string`): 需要转换为 Pascal 大小写的字符串。
|
||||
|
||||
### 返回值
|
||||
|
||||
(`string`): 转换为 Pascal 大小写的字符串。
|
||||
|
||||
## 示例
|
||||
|
||||
```typescript
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
const convertedStr1 = pascalCase('pascalCase'); // returns 'PascalCase'
|
||||
const convertedStr2 = pascalCase('some whitespace'); // returns 'SomeWhitespace'
|
||||
const convertedStr3 = pascalCase('hyphen-text'); // returns 'HyphenText'
|
||||
const convertedStr4 = pascalCase('HTTPRequest'); // returns 'HttpRequest'
|
||||
```
|
||||
|
||||
## 演示
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { pascalCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(pascalCase('pascalCase'));
|
||||
```
|
||||
|
||||
:::
|
46
docs/zh_hans/reference/string/startCase.md
Normal file
46
docs/zh_hans/reference/string/startCase.md
Normal file
@ -0,0 +1,46 @@
|
||||
# startCase
|
||||
|
||||
将字符串转换为 Start 大小写。
|
||||
|
||||
Start 大小写是一种命名约定,其中标识符中每个单词的首字母大写,其余字母小写,单词之间用空格分隔,例如 `Start Case`。
|
||||
|
||||
## 签名
|
||||
|
||||
```typescript
|
||||
function startCase(str: string): string;
|
||||
```
|
||||
|
||||
### 参数
|
||||
|
||||
- `str` (`string`): 需要转换为 Start 大小写的字符串。
|
||||
|
||||
### 返回值
|
||||
|
||||
(`string`) The string converted to start case.
|
||||
|
||||
## 示例
|
||||
|
||||
```typescript
|
||||
import { startCase } from 'es-toolkit/string';
|
||||
|
||||
startCase('--foo-bar--'); // returns 'Foo Bar'
|
||||
startCase('fooBar'); // returns 'Foo Bar'
|
||||
startCase('__FOO_BAR__'); // returns 'FOO BAR'
|
||||
startCase('XMLHttpRequest'); // returns 'XML Http Request'
|
||||
startCase('_abc_123_def'); // returns 'Abc 123 Def'
|
||||
startCase('__abc__123__def__'); // returns 'Abc 123 Def'
|
||||
startCase('_-_-_-_'); // returns ''
|
||||
startCase('12abc 12ABC'); // returns '12 Abc 12 ABC'
|
||||
```
|
||||
|
||||
## 演示
|
||||
|
||||
::: sandpack
|
||||
|
||||
```ts index.ts
|
||||
import { startCase } from 'es-toolkit/string';
|
||||
|
||||
console.log(startCase('startCase'));
|
||||
```
|
||||
|
||||
:::
|
Loading…
Reference in New Issue
Block a user