# is-include-items()

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

리스트(A)가 포함하는 아이템이 다른 리스트(B)에도 포함되는 지 여부를 판단 할 때 사용합니다.

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

`is-include-items()` 함수에 비교할 2개의 리스트를 전달합니다.

> is-include-items($list:**list**, $comparelis&#x74;**:list**) → **bool**

```javascript
$keywords: unset;

@debug is-include-items($keywords, initial unset auto); // true 반환
```

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

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

```javascript
@if is-include-items($args, auto initial none) {
  // ...
} @else {
  // ...
}
```

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

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

```javascript
@function is-include-items($list, $comparelist) {
  $result-list: ();

  @each $item in $list {
    $result-list: append($result-list, is-valid-keywords($item, $comparelist));
  }

  @return type-of(index($result-list, true)) == 'number';
}
```

1. 전달 받은 2개의 리스트 안에 포함된 아이템을 비교
2. 일치하는 값이 있을 경우, `true` [불리언(bool) ](https://sass-lang.com/documentation/values/booleans)값 반환
3. 일치하는 값이 없을 경우, `false` 불리언 값 반환

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

유틸리티 함수 로직에 사용된 Sass의 빌트인 모듈은 다음과 같습니다.

* [@each](https://sass-lang.com/documentation/at-rules/control/each)
* [append()](https://sass-lang.com/documentation/modules/list#append)
* [type-of()](https://sass-lang.com/documentation/modules/meta#type-of)
* [index()](https://sass-lang.com/documentation/modules/list#index)

유틸리티 함수 로직에 사용된 자체 제작 모듈은 다음과 같습니다.

* [is-valid-keywords()](https://yamoo9.gitbook.io/scss-mixins/utilities/validation/is-valid-keywords)


---

# 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-include-items.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.
