# is-valid-keywords()

## 용도 <a href="#use" id="use"></a>

커스텀 유틸리티 함수 작성 시, 특정 값이 여러 키워드 중 하나와 일치하는 지 확인해야 할 때 사용합니다.

## 사용법 <a href="#usage" id="usage"></a>

`is-valid-keywords()` 함수에 특정 값과 기대되는 키워드 리스트를 전달합니다.

> is-valid-keywords($data:**any**, $keywordlis&#x74;**:list**) → **bool**

```css
$value: auto;

@debug is-valid-keywords($value, initial inherit); // false 반환
```

| 매개변수(parameter) | 유형(type) | 필수(required) | 기본 값(default) |
| :-------------: | :------: | :----------: | :-----------: |
|      $data      |    any   |      ✔︎      |               |
|   $keywordlist  |   list   |      ✔︎      |               |

유틸리티 함수 안에서 자료형을 검사한 후, 결과 값에 따라 코드를 [조건 분기](https://dic.daum.net/word/view.do?wordid=kkw000798259\&supid=kku010808082)하는 예시

```javascript
@if is-valid-keywords($value, auto inherit initial none)) {
  // ...
} @else {
  // ...
}
```

## 로직 <a href="#logic" id="logic"></a>

`is-valid-keywords()` 유틸리티는 다음의 로직에 의해 작성되었습니다.&#x20;

```javascript
@function is-valid-keywords($data, $keywordlist) {
  @each $valid-type in $keywordlist {
    @if $data == $valid-type { @return true; }
  }
  @return false;
}
```

1. 전달 받은 키워드 리스트를 순환하여 키워드와 전달 받은 데이터 값을 비교
2. 값이 일치할 경우, `true` [불리언(bool) ](https://sass-lang.com/documentation/values/booleans)값 반환
3. 값이 일치하지 않을 경우, `false` 불리언 값 반환

## 참고 <a href="#reference" id="reference"></a>

유틸리티 함수 로직에 사용된 Sass의 흐름 제어(Flow Control) 문은 다음과 같습니다.

* [@each](https://sass-lang.com/documentation/at-rules/control/each)
* [@if / @else](https://sass-lang.com/documentation/at-rules/control/if)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yamoo9.gitbook.io/scss-mixins/utilities/validation/is-valid-keywords.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
