mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 03:34:26 +03:00
docs(isPrimitive): fix isPrimitive function documentations (#331)
* fix: isPrimitive function * docs: fix isPrimitive docs * docs: fix isPrimitive jsdoc
This commit is contained in:
parent
876931405a
commit
25217a571e
@ -7,16 +7,16 @@ JavaScript 원시 값은 null, undefined, string, number, symbol, bigint를 말
|
||||
## 인터페이스
|
||||
|
||||
```typescript
|
||||
function isPrimitive(x: unknown): x is null | undefined | string | number | boolean | symbol | bigint;
|
||||
function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint;
|
||||
```
|
||||
|
||||
### 파라미터
|
||||
|
||||
- `x` (`unknown`): 검사할 값.
|
||||
- `value` (`unknown`): 검사할 값.
|
||||
|
||||
### 반환 값
|
||||
|
||||
(`x is null | undefined | string | number | boolean | symbol | bigint`): 값이 원시 값이면 `true`, 아니면 `false`.
|
||||
(`value is null | undefined | string | number | boolean | symbol | bigint`): 값이 원시 값이면 `true`, 아니면 `false`.
|
||||
|
||||
## 예시
|
||||
|
||||
|
@ -7,16 +7,16 @@ JavaScript primitives include null, undefined, strings, numbers, booleans, symbo
|
||||
## Signature
|
||||
|
||||
```typescript
|
||||
function isPrimitive(x: unknown): x is null | undefined | string | number | boolean | symbol | bigint;
|
||||
function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint;
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
- `x` (`unknown`): The value to check.
|
||||
- `value` (`unknown`): The value to check.
|
||||
|
||||
### Returns
|
||||
|
||||
(`x is null | undefined | string | number | boolean | symbol | bigint`): True if the value is a primitive, otherwise false.
|
||||
(`value is null | undefined | string | number | boolean | symbol | bigint`): True if the value is a primitive, otherwise false.
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -7,16 +7,16 @@ JavaScript 的原始类型包括 null、undefined、字符串、数字、布尔
|
||||
## 签名
|
||||
|
||||
```typescript
|
||||
function isPrimitive(x: unknown): x is null | undefined | string | number | boolean | symbol | bigint;
|
||||
function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint;
|
||||
```
|
||||
|
||||
### 参数
|
||||
|
||||
- `x` (`unknown`): 要检查的值。
|
||||
- `value` (`unknown`): 要检查的值。
|
||||
|
||||
### 返回
|
||||
|
||||
(`x is null | undefined | string | number | boolean | symbol | bigint`): 如果值是原始类型则返回 true,否则返回 false。
|
||||
(`value is null | undefined | string | number | boolean | symbol | bigint`): 如果值是原始类型则返回 true,否则返回 false。
|
||||
|
||||
## 示例
|
||||
|
||||
|
@ -2,15 +2,15 @@
|
||||
* Checks whether a value is a JavaScript primitive.
|
||||
* JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
|
||||
*
|
||||
* @param {unknown} x The value to check.
|
||||
* @returns {x is
|
||||
* @param {unknown} value The value to check.
|
||||
* @returns {value is
|
||||
* | null
|
||||
* | undefined
|
||||
* | string
|
||||
* | number
|
||||
* | boolean
|
||||
* | symbol
|
||||
* | bigint} Returns true if `x` is a primitive, false otherwise.
|
||||
* | bigint} Returns true if `value` is a primitive, false otherwise.
|
||||
*/
|
||||
export function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint {
|
||||
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
||||
|
Loading…
Reference in New Issue
Block a user