Skip to content

Commit

Permalink
docs : isSet
Browse files Browse the repository at this point in the history
  • Loading branch information
chhw130 committed Sep 25, 2024
1 parent 5e12885 commit 4e9f522
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/ko/reference/predicate/isSet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# isSet

주어진 값이 `Set`의 인스턴스인지 확인해요.

값이 `Set`이면 `true`, 아니면 `false`를 반환해요.

TypeScript의 타입 가드로 주로 사용되는데요, 파라미터로 주어진 값을 `Set`인 타입으로 좁힐 수 있어요.

## 인터페이스

```typescript
function isSet(value: unknown): value is Set<any>;
```

### 파라미터

- `value` (`unknown`): `Set`인지 확인할 값.

### 반환 값

(`value is Set<any>`): 값이 `Set`이면 `true`, 아니면 `false`.

## 예시

```typescript
const value1 = new Set();
const value2 = new Map();
const value3 = new WeakSet();

console.log(isSet(value1)); // true
console.log(isSet(value2)); // false
console.log(isSet(value3)); // false
```
34 changes: 34 additions & 0 deletions docs/reference/predicate/isSet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# isSet

Checks if the given value is a `Set`.

This function tests whether the provided value is an instance of `Set`.
It returns `true` if the value is a `Set`, and `false` otherwise.

This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Set`.

## Signature

```typescript
function isSet(value: unknown): value is Set<any>;
```

### Parameters

- `value` (`unknown`): The value to check if it is a `Set`.

### Returns

(`value is Set<any>`): true if the value is a `Set`, false otherwise.

## Examples

```typescript
const value1 = new Set();
const value2 = new Map();
const value3 = new WeakSet();

console.log(isSet(value1)); // true
console.log(isSet(value2)); // false
console.log(isSet(value3)); // false
```

0 comments on commit 4e9f522

Please sign in to comment.