From 5d34b16683f61708a3c22dc5cec3489209afde8c Mon Sep 17 00:00:00 2001 From: Sojin Park Date: Sat, 10 Aug 2024 10:26:23 +0900 Subject: [PATCH] docs(pascalCase, startCase): Add docs for pascalCase & startCase --- docs/.vitepress/en.mts | 1 + docs/.vitepress/ko.mts | 1 + docs/.vitepress/zh_hans.mts | 2 + docs/ko/reference/string/pascalCase.md | 42 +++++++++++++++++++ docs/ko/reference/string/startCase.md | 12 ++++++ docs/reference/string/pascalCase.md | 42 +++++++++++++++++++ docs/reference/string/startCase.md | 12 ++++++ docs/zh_hans/reference/string/pascalCase.md | 42 +++++++++++++++++++ docs/zh_hans/reference/string/startCase.md | 46 +++++++++++++++++++++ 9 files changed, 200 insertions(+) create mode 100644 docs/ko/reference/string/pascalCase.md create mode 100644 docs/reference/string/pascalCase.md create mode 100644 docs/zh_hans/reference/string/pascalCase.md create mode 100644 docs/zh_hans/reference/string/startCase.md diff --git a/docs/.vitepress/en.mts b/docs/.vitepress/en.mts index 76dd441e..17f379d6 100644 --- a/docs/.vitepress/en.mts +++ b/docs/.vitepress/en.mts @@ -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' }, diff --git a/docs/.vitepress/ko.mts b/docs/.vitepress/ko.mts index 65332459..9fbfd7b5 100644 --- a/docs/.vitepress/ko.mts +++ b/docs/.vitepress/ko.mts @@ -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' }, diff --git a/docs/.vitepress/zh_hans.mts b/docs/.vitepress/zh_hans.mts index 440ceb8e..e7942052 100644 --- a/docs/.vitepress/zh_hans.mts +++ b/docs/.vitepress/zh_hans.mts @@ -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' }, diff --git a/docs/ko/reference/string/pascalCase.md b/docs/ko/reference/string/pascalCase.md new file mode 100644 index 00000000..0b81f83e --- /dev/null +++ b/docs/ko/reference/string/pascalCase.md @@ -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')); +``` + +::: diff --git a/docs/ko/reference/string/startCase.md b/docs/ko/reference/string/startCase.md index fe0c5397..1c7298ca 100644 --- a/docs/ko/reference/string/startCase.md +++ b/docs/ko/reference/string/startCase.md @@ -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')); +``` + +::: diff --git a/docs/reference/string/pascalCase.md b/docs/reference/string/pascalCase.md new file mode 100644 index 00000000..d0bf51e6 --- /dev/null +++ b/docs/reference/string/pascalCase.md @@ -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')); +``` + +::: diff --git a/docs/reference/string/startCase.md b/docs/reference/string/startCase.md index 5d36437c..53cb6893 100644 --- a/docs/reference/string/startCase.md +++ b/docs/reference/string/startCase.md @@ -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')); +``` + +::: diff --git a/docs/zh_hans/reference/string/pascalCase.md b/docs/zh_hans/reference/string/pascalCase.md new file mode 100644 index 00000000..65152b14 --- /dev/null +++ b/docs/zh_hans/reference/string/pascalCase.md @@ -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')); +``` + +::: diff --git a/docs/zh_hans/reference/string/startCase.md b/docs/zh_hans/reference/string/startCase.md new file mode 100644 index 00000000..cba34c12 --- /dev/null +++ b/docs/zh_hans/reference/string/startCase.md @@ -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')); +``` + +:::