# areDeterminer()

## `areDeterminer()`

The function returns the object of [`every()`](/are/aredeterminer/every.md), [`forEach()`](/are/aredeterminer/foreach.md) and [`some()`](/are/aredeterminer/some.md) methods to check given [`values`](#...values-any) with the test implemented by the given [`checkFn`](#checkfn-function) function.

{% code title="are-determiner.func.ts" %}

```typescript
const areDeterminer = <CommonPayload extends object>(
  checkFn: Function,
  ...values: any[]
) => {
  return {
    every: <Payload extends CommonPayload>(
      callback: ResultCallback<any, Payload> = resultCallback,
      payload?: Payload
    ): boolean =>
      callback(
        values.every((value) => checkFn(value)),
        values,
        payload
      ),

    forEach: <Payload extends CommonPayload>(
      forEachCallback: ForEachCallback<any, Payload>,
      payload?: Payload
    ) => {
      isArray(values) &&
        isFunction(forEachCallback) &&
        values.forEach((value, index) =>
          forEachCallback(checkFn(value), value, index, values, payload)
        );
    },

    some: <Payload extends CommonPayload>(
      callback: ResultCallback<any, Payload> = resultCallback,
      payload?: Payload
    ): boolean =>
      callback(
        isArray(values) ? values.some((value) => checkFn(value)) : false,
        values,
        payload
      ),
  };
};
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">**`CommonPayload`**</mark>**`extends`**<mark style="color:green;">**`object`**</mark>

The `CommonPayload` generic type variable constrained by the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) constrains the generic type variable `Payload` of each returned method.

### Parameters

#### `checkFn: Function`

Function to test given [`values`](#...values-any).

#### `...values: any[]`

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against test given in the [`checkFn`](#checkfn-function) function.

### Returns

The **return value** is an [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) of [`every()`](/are/aredeterminer/every.md), [`some()`](/are/aredeterminer/some.md) and [`forEach()`](/are/aredeterminer/foreach.md) as methods of checking supplied [`values`](#...values-any).


---

# 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://type.angular-package.dev/are/aredeterminer.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.
