-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
589 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# defer | ||
|
||
::: info | ||
この関数は互換性のために `es-toolkit/compat` からのみインポートできます。代替可能なネイティブ JavaScript API があるか、まだ十分に最適化されていないためです。 | ||
|
||
`es-toolkit/compat` からこの関数をインポートすると、[lodash と完全に同じように動作](../../../compatibility.md)します。 | ||
::: | ||
|
||
`func`を呼び出しを、現在のコールスタックがクリアされるまで遅延します。追加の引数は、呼び出されたときに`func`に提供されます。 | ||
|
||
## インターフェース | ||
|
||
```typescript | ||
function defer<F extends (...args: any[]) => any>(func: F, ...args: Parameters<F>): number; | ||
``` | ||
|
||
### パラメータ | ||
|
||
- `func` (`F`): 遅延する関数。 | ||
- `args` (`Parameters<F>`): `func`を呼び出すための引数。 | ||
|
||
### 戻り値 | ||
|
||
(`number`): タイマーID。 | ||
|
||
## 例 | ||
|
||
```typescript | ||
defer((text) => { | ||
console.log(text); | ||
}, 'deferred'); | ||
// => Logs 'deferred' after the current call stack has cleared. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# toFinite | ||
|
||
::: info | ||
この関数は互換性のために `es-toolkit/compat` からのみインポートできます。代替可能なネイティブ JavaScript API があるか、まだ十分に最適化されていないためです。 | ||
|
||
`es-toolkit/compat` からこの関数をインポートすると、[lodash と完全に同じように動作](../../../compatibility.md)します。 | ||
::: | ||
|
||
`value` を有限の数値に変換します。 | ||
|
||
## インターフェース | ||
|
||
```typescript | ||
function toFinite(value?: unknown): number; | ||
``` | ||
|
||
### パラメータ | ||
|
||
- `value` (`unknown`): 変換する値。 | ||
|
||
### 戻り値 | ||
|
||
(`number`): 有限の数値。 | ||
|
||
## 例 | ||
|
||
```typescript | ||
toNumber(3.2); // => 3.2 | ||
toNumber(Number.MIN_VALUE); // => 5e-324 | ||
toNumber(Infinity); // => 1.7976931348623157e+308 | ||
toNumber('3.2'); // => 3.2 | ||
toNumber(Symbol.iterator); // => 0 | ||
toNumber(NaN); // => 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# toInteger | ||
|
||
::: info | ||
この関数は互換性のために `es-toolkit/compat` からのみインポートできます。代替可能なネイティブ JavaScript API があるか、まだ十分に最適化されていないためです。 | ||
|
||
`es-toolkit/compat` からこの関数をインポートすると、[lodash と完全に同じように動作](../../../compatibility.md)します。 | ||
::: | ||
|
||
`value`を整数に変換します。無限大の値の場合は、有限の値に変換されます。小数点以下の数字は切り捨てられます。 | ||
|
||
## インターフェース | ||
|
||
```typescript | ||
function toInteger(value?: unknown): number; | ||
``` | ||
|
||
### パラメータ | ||
|
||
- `value` (`unknown`): 変換する値。 | ||
|
||
### 戻り値 | ||
|
||
(`number`): 整数。 | ||
|
||
## 例 | ||
|
||
```typescript | ||
toInteger(3.2); // => 3 | ||
toInteger(Number.MIN_VALUE); // => 0 | ||
toInteger(Infinity); // => 1.7976931348623157e+308 | ||
toInteger('3.2'); // => 3 | ||
toInteger(Symbol.iterator); // => 0 | ||
toInteger(NaN); // => 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# toNumber | ||
|
||
::: info | ||
この関数は互換性のために `es-toolkit/compat` からのみインポートできます。代替可能なネイティブ JavaScript API があるか、まだ十分に最適化されていないためです。 | ||
|
||
`es-toolkit/compat` からこの関数をインポートすると、[lodash と完全に同じように動作](../../../compatibility.md)します。 | ||
::: | ||
|
||
`value`を数値に変換します。 | ||
|
||
`Number()`とは異なり、この関数はシンボルに対して`NaN`を返します。 | ||
|
||
## インターフェース | ||
|
||
```typescript | ||
function toNumber(value?: unknown): number; | ||
``` | ||
|
||
### パラメータ | ||
|
||
- `value` (`unknown`): 変換する値。 | ||
|
||
### 戻り値 | ||
|
||
(`number`): 変換された数値。 | ||
|
||
## 例 | ||
|
||
```typescript | ||
toNumber(3.2); // => 3.2 | ||
toNumber(Number.MIN_VALUE); // => 5e-324 | ||
toNumber(Infinity); // => Infinity | ||
toNumber('3.2'); // => 3.2 | ||
toNumber(Symbol.iterator); // => NaN | ||
toNumber(NaN); // => NaN | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# constantCase | ||
|
||
文字列を定数ケースに変換します。 | ||
|
||
定数ケースは、各単語が大文字で書かれ、アンダースコア(`_`)で区切られる命名規則です。たとえば、`CONSTANT_CASE`。 | ||
|
||
## インターフェース | ||
|
||
```typescript | ||
function constantCase(str: string): string; | ||
``` | ||
|
||
### パラメータ | ||
|
||
- `str` (`string`): 定数ケースに変更される文字列。 | ||
|
||
### 戻り値 | ||
|
||
(`string`): 定数ケースに変換された文字列。 | ||
|
||
## 例 | ||
|
||
```typescript | ||
const convertedStr1 = constantCase('camelCase') // returns 'CAMEL_CASE' | ||
const convertedStr2 = constantCase('some whitespace') // returns 'SOME_WHITESPACE' | ||
const convertedStr3 = constantCase('hyphen-text') // returns 'HYPHEN_TEXT' | ||
const convertedStr4 = constantCase('HTTPRequest') // returns 'HTTP_REQUEST' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# defer | ||
|
||
::: info | ||
이 함수는 호환성을 위한 `es-toolkit/compat` 에서만 가져올 수 있어요. 대체할 수 있는 네이티브 JavaScript API가 있거나, 아직 충분히 최적화되지 않았기 때문이에요. | ||
|
||
`es-toolkit/compat`에서 이 함수를 가져오면, [lodash와 완전히 똑같이 동작](../../../compatibility.md)해요. | ||
::: | ||
|
||
함수 `func`를 현재 호출 스택이 끝날 때까지 지연시켜요. | ||
|
||
## 인터페이스 | ||
|
||
```typescript | ||
function defer<F extends (...args: any[]) => any>(func: F, ...args: Parameters<F>): number; | ||
``` | ||
|
||
### 파라미터 | ||
|
||
- `func` (`F`): 지연시킬 함수. | ||
- `args` (`Parameters<F>`): `func`를 호출할 인수. | ||
|
||
### 반환 값 | ||
|
||
(`number`): 타이머 ID. | ||
|
||
## 예시 | ||
|
||
```typescript | ||
defer((text) => { | ||
console.log(text); | ||
}, 'deferred'); | ||
// => Logs 'deferred' after the current call stack has cleared. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# toFinite | ||
|
||
::: info | ||
이 함수는 호환성을 위한 `es-toolkit/compat` 에서만 가져올 수 있어요. 대체할 수 있는 네이티브 JavaScript API가 있거나, 아직 충분히 최적화되지 않았기 때문이에요. | ||
|
||
`es-toolkit/compat`에서 이 함수를 가져오면, [lodash와 완전히 똑같이 동작](../../../compatibility.md)해요. | ||
::: | ||
|
||
`value`를 유한한 숫자로 변환해요. | ||
|
||
## 인터페이스 | ||
|
||
```typescript | ||
function toFinite(value?: unknown): number; | ||
``` | ||
|
||
### 파라미터 | ||
|
||
- `value` (`unknown`): 변환할 값. | ||
|
||
### 반환 값 | ||
|
||
(`number`): 유한한 숫자. | ||
|
||
## 예시 | ||
|
||
```typescript | ||
toNumber(3.2); // => 3.2 | ||
toNumber(Number.MIN_VALUE); // => 5e-324 | ||
toNumber(Infinity); // => 1.7976931348623157e+308 | ||
toNumber('3.2'); // => 3.2 | ||
toNumber(Symbol.iterator); // => 0 | ||
toNumber(NaN); // => 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# toInteger | ||
|
||
::: info | ||
이 함수는 호환성을 위한 `es-toolkit/compat` 에서만 가져올 수 있어요. 대체할 수 있는 네이티브 JavaScript API가 있거나, 아직 충분히 최적화되지 않았기 때문이에요. | ||
|
||
`es-toolkit/compat`에서 이 함수를 가져오면, [lodash와 완전히 똑같이 동작](../../../compatibility.md)해요. | ||
::: | ||
|
||
`value`를 정수로 변환해요. 무한한 값인 경우, 유한한 값으로 변환돼요. 소숫점 아래 숫자는 버려요. | ||
|
||
## 인터페이스 | ||
|
||
```typescript | ||
function toInteger(value?: unknown): number; | ||
``` | ||
|
||
### 파라미터 | ||
|
||
- `value` (`unknown`): 변환할 값. | ||
|
||
### 반환 값 | ||
|
||
(`number`): 변환된 정수. | ||
|
||
## 예시 | ||
|
||
```typescript | ||
toInteger(3.2); // => 3 | ||
toInteger(Number.MIN_VALUE); // => 0 | ||
toInteger(Infinity); // => 1.7976931348623157e+308 | ||
toInteger('3.2'); // => 3 | ||
toInteger(Symbol.iterator); // => 0 | ||
toInteger(NaN); // => 0 | ||
``` |
Oops, something went wrong.