# Introduction

The `type` package's purpose is to determine the type of single or multiple values and guard single values. It also contains common types that can be useful for other packages.

### Check & guard

The `check` means to determine the value of [any](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type by using dedicated functions like `'isNaN()'` , methods like `'isArray()'`, and operators `'typeof'`  `'instanceof'`. The `type` package functions for checking the values are prefixed with '**are**' '**is**' '**isNot**' word.

The `guard` means the same as a check but with an additional constrain type, and guard functions are prefixed with the '**guard**' word.

### Single and multiple

The difference between prefixed with '**is**' and '**are**' functions is, prefixed with '**is**' are used to check a single value of any type, prefixed with '**are**' are used for checking multiple values of any type against one type. Additionally, checking multiple values is determined by `every()`, `forEach()` or `some()` methods.

### Precise

To make the functions more precise, besides the use of '[typeof](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)' and '[instanceof](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof)' operators, some of them use method '**`toString()`**' of the two objects '[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString)' and '[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString)' to detect the type.

### Result handler & payload

Each function includes an optional callback function to handle the check result and an optional payload. The payload parameter of the callback function contains additional useful properties specific to the function and can be extended by the payload parameter of the core function.


# ❤ Benefits

<details>

<summary>Single value check</summary>

Check single value against one type.

</details>

<details>

<summary>Multiple value check</summary>

Check **every** of multiple values against one type.

Check **some** of the multiple values against one type.

Check **one by one** of the multiple values against one type.

</details>

<details>

<summary>Guard the value type</summary>

Predefined functions to guard the most commonly used types.

</details>

<details>

<summary>Objects consisting of check and guard functions</summary>

Predefined objects that contain name-specific functionalities.

Object `type` that consists of all the guard and check functions.

Object `are`, `is` and `isNot` to check the values.

Object `guard` to guard the values.

</details>

<details>

<summary>Callback</summary>

Each function has a `callback` parameter to handle the check result before it's returned.

The callback function includes a `payload` parameter consisting of properties specific to the core function, and it is extendable by custom properties.

</details>

<details>

<summary>Payload</summary>

Each function has an optional `payload` parameter to assign custom properties to the `payload` of the given callback function.

</details>


# Skeleton

The package was generated by the [library skeleton](https://github.com/angular-package/skeleton) which was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.0.&#x20;

Copy package to the `packages/type` folder of the [library skeleton](https://github.com/angular-package/skeleton) then run the commands below.

## Code scaffolding

Run `ng generate component component-name --project type` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project type`.

> Note: Don't forget to add `--project type` or else it will be added to the default project in your `angular.json` file.

### Build

Run `ng build type` to build the project. The build artifacts will be stored in the `dist/type` directory.

### **Publishing**

After building your library with `ng build type`, go to the dist folder `cd dist/type` and run `npm publish`.

### **Running unit tests**

Before the test can be performed install [`@angular-package/testing`](https://github.com/angular-package/testing) with command:&#x20;

```bash
npm i @angular-package/testing --no-save
```

Run `ng test type` to execute the unit tests via [Karma](https://karma-runner.github.io).

### Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.


# Installation

The package can be installed into your project via [NPM](https://www.npmjs.com/), or [yarn](https://yarnpkg.com/getting-started/install).

{% tabs %}
{% tab title="npm" %}

```
npm install @angular-package/type --save
```

{% endtab %}

{% tab title="yarn" %}

```
yarn add @angular-package/type
```

{% endtab %}
{% endtabs %}


# Public API

{% embed url="<https://github.com/angular-package/type/blob/main/src/public-api.ts>" %}

## Function

### Helper

Help to determine the value type.

```typescript
// Helper.
import {
  recognizeValue, // From the `5.0.0` version
  typeOf,
} from '@angular-package/type';
```

### `is`

Functions with the prefix **`is`** determine whether the value of [any](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type is of the specified type.

```typescript
// `is` prefix functions.
import {
  isArray,
  isBigInt,
  isBoolean,
  isBooleanObject,
  isBooleanType,
  isClass,
  isDate, // From the 4.2.0 version.
  isDefined,
  isFalse, // From the 4.2.0 version.
  isFunction,
  isInstance,
  isKey,
  isNull,
  isNumber,
  isNumberBetween, // From the 4.2.0 version.
  isNumberObject,
  isNumberType,
  isObject,
  isObjectKey,
  isObjectKeyIn,
  isObjectKeys,
  isObjectKeysIn, // From the 5.0.0 version
  isObjectSomeKeys, // From the 5.0.0 version
  isParam,
  isPrimitive,
  isRegExp, // From the 4.2.0 version.
  isString,
  isStringIncludes, // From the 5.0.0 version
  isStringIncludesSome, // From the 5.0.0 version
  isStringLength, // From the 4.2.0 version.
  isStringLengthBetween, // From the 5.0.0 version
  isStringObject,
  isStringType,
  isSymbol,
  isTrue, // From the 4.2.0 version.
  isType,
  isUndefined,
} from '@angular-package/type';
```

### `isNot`

Functions with the prefix **`isNot`** determine whether the value of [any](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type is **not** of a specified type.

```typescript
// `isNot` prefix functions.
import {
  isNotBoolean,
  isNotDefined,
  isNotFunction,
  isNotNull,
  isNotNumber,
  isNotString,
  isNotUndefined
} from '@angular-package/type';
```

### `are`

Functions with the prefix **`are`** determine whether the values of [any](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type are of the specified type.

```typescript
// `are` prefix functions.
import {
  // Function.
  areBigInt, // From the `5.0.0` version
  areBoolean, // From the `5.0.0` version
  areDate, // From the `5.0.0` version
  areDefined, // From the `5.0.0` version
  areFalse, // From the `5.0.0` version
  areNull, // From the `5.0.0` version
  areNumber, // From the `5.0.0` version
  areRegExp, // From the `5.0.0` version
  areString,
  areSymbol, // From the `5.0.0` version
  areTrue, // From the `5.0.0` version
  areUndefined, // From the `5.0.0` version
} from '@angular-package/type';
```

### `guard`

Functions with the prefix **`guard`** constraint the type and determine the value is of the specified type.

```typescript
// `guard` prefix functions.
import { 
  guardArray,
  guardBigInt,
  guardBoolean,
  guardClass,
  guardDate, // From the 5.0.0 version
  guardDefined,
  guardFalse, // From the 5.0.0 version
  guardFunction,
  guardInstance,
  guardKey,
  guardNull,
  guardNumber,
  guardNumberBetween, // From the 5.0.0 version
  guardObject,
  guardObjectKey,
  guardObjectKeyIn, // From the 5.0.0 version
  guardObjectKeys,
  guardObjectSomeKeys, // From the 5.0.0 version
  guardPrimitive,
  guardRegExp, // From the 5.0.0 version
  guardString,
  guardStringLength, // From the 5.0.0 version
  guardStringLengthBetween, // From the 5.0.0 version
  guardStringIncludes, // From the 5.0.0 version
  guardStringIncludesSome, // From the 5.0.0 version
  guardSymbol,
  guardTrue, // From the 5.0.0 version
  guardType,
  guardUndefined,
} from '@angular-package/type'; 
```

## Object

The objects represent the check and guard functions.

```typescript
// Objects.
import {
  are,
  guard,
  is,
  isNot,
  type
} from '@angular-package/type';
```

## Interface

```typescript
// Interfaces.
import {
  MinMax
} from '@angular-package/type';
```

## Type

```typescript
// Types.
import {
  AnyBoolean,
  AnyNumber,
  AnyString,
  CallbackPayload, // From the `5.0.0` version.
  Constructor,
  Defined,
  ForEachCallback,  // From the `5.0.0` version.
  GenericObject, // From the `5.0.0` version.
  Never,
  NotUndefined,
  NumberBetween, // From the `4.2.0` version.
  Primitive,
  Primitives,
  ResultCallback, // From the `4.2.0` version
  StringOfLength, // From the `4.2.0` version.`
  Type,
  Types,
  Undefined
} from '@angular-package/type';
```


# General concepts

### ⚠

The warning sign indicates the element is **not** **available**.

### ★

The element starred as most **useful**.

### **Checks**

It's to **check** the provided value to be the same as **expected**.

### Type guard (constrain)

Constrains the parameter type to not let input unexpected value in the code editor.

### **Guard**

It's a **combination** of both above, **constrains** the type of the parameter in the **code editor**, and checks its provided argument.

### **Defines**

Returns defined value from a method of an object.

Defines new value in an object and returns a defined value.

### **Gets**

Returns a value from an object.

### **Sets**

Adds or updates an element with a specified key and a value to an object and returns an object.

{% embed url="<https://docs.angular-package.dev/v/designing/definitions>" %}
More definitions
{% endembed %}


# recognizeValue()

## `recognizeValue()`

Gets recognized types and instances of given [`value`](#value-any).

{% code title="recognize-value.func.ts" %}

```typescript
const recognizeValue = (
  value: any,
  onlyTrue: boolean = true,
  instances: any[] = []
): OfRecognized => {
  // Recognize types.
  const ofRecognized: OfRecognized = {
    'Array.isArray': Array.isArray(value),
    isClass: is.class(value),
    isFunction: is.function(value),
    'Number.isInteger': Number.isInteger(value),
    'Number.isFinite': Number.isFinite(value),
    'Number.isNaN': Number.isNaN(value),
    'Number.isSafeInteger': Number.isSafeInteger(value),
    typeOf: typeOf(value),
    typeof: typeof value,
  };

  try { Object.assign(ofRecognized, { isFinite: isFinite(value) }); } catch (e) {}
  try { Object.assign(ofRecognized, { isNaN: isNaN(value) }); } catch (e) {}

  // Recognize instances.
  RECOGNIZE_INSTANCES.concat(instances as any).forEach((instance) => (
    Object.assign(ofRecognized, { [instance.name]: value instanceof instance })
  ));

  // If only true remove false.
  if (is.true(onlyTrue)) {
    Object.keys(ofRecognized).filter((type: string) =>
      is.false(ofRecognized[type as keyof OfRecognized])
        ? delete ofRecognized[type as keyof OfRecognized]
        : true
    );
  }
  return ofRecognized;
};
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/recognize/src/recognize-value.func.ts>" %}

### Parameters

#### `value: any`

The `value` of any type to recognize.

#### `onlyTrue: boolean`

Determines whether to show only recognized as `true`.

#### `instances: any[]`

An optional array of objects to check by using [`instanceof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof) operator.

### Return type

#### `OfRecognized`

The **return type** is an interface of the operators and functions used to check.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of types and instances recognized as `true` or all even those recognized as `false`.

## Example usage

```typescript
// Example usage.
import { recognizeValue } from '@angular-package/type';

// Class.
class CustomClass {}
const customClass = new CustomClass();

// String.
const firstName = 'Artemis';


/*
Returns {
  "typeOf": "object",
  "typeof": "object",
  "isNaN": true,
  "Object": true,
  "CustomClass": true
}
*/
recognizeValue(customClass, true, [CustomClass]);

/*
Returns {
  "isClass": true,
  "typeOf": "function",
  "typeof": "function",
  "isNaN": true,
  "Function": true,
  "Object": true
}
*/
recognizeValue(CustomClass);

/*
Returns {
  "typeOf": "string",
  "typeof": "string",
  "isNaN": true
}
*/
recognizeValue(firstName);

/*
Returns {
  "typeOf": "string",
  "typeof": "object",
  "isNaN": true,
  "Object": true,
  "String": true
}
*/
recognizeValue(new String(firstName));
```


# Recognized instances

## Recognized instances

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of default objects that is used by the [`recognizeValue()`](https://type.angular-package.dev/helper/recognizevalue) function to check the value instance by using the [`instanceof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof) operator. It can be expanded by the provided [`instances`](#instances-any) parameter.

{% code title="recognize-instances.const.ts" %}

```typescript
const RECOGNIZE_INSTANCES = [
  Array,
  ArrayBuffer,
  Boolean,
  DataView,
  Date,
  Error,
  EvalError,
  Float32Array,
  Float64Array,
  Function,
  Int16Array,
  Int32Array,
  Int8Array,
  Map,
  Number,
  Object,
  Promise,
  RangeError,
  ReferenceError,
  RegExp,
  Set,
  Storage,
  String,
  SyntaxError,
  TypeError,
  URIError,
  Uint16Array,
  Uint32Array,
  Uint8Array,
  Uint8ClampedArray,
  WeakMap,
  WeakSet
];
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/recognize/src/recognize-instances.const.ts>" %}


# OfRecognized

## `OfRecognized`

The generic type represents the returned object of recognized instances, types, and other tests.

{% code title="of-recognized.interface.ts" %}

```typescript
interface OfRecognized {
  // Proxy?: boolean;
  Array?: boolean;
  ArrayBuffer?: boolean;
  Boolean?: boolean;
  DataView?: boolean;
  Date?: boolean;
  Error?: boolean;
  EvalError?: boolean;
  Float32Array?: boolean;
  Float64Array?: boolean;
  Function?: boolean;
  Int16Array?: boolean;
  Int32Array?: boolean;
  Int8Array?: boolean;
  Map?: boolean;
  Number?: boolean;
  Object?: boolean;
  Promise?: boolean;
  RangeError?: boolean;
  ReferenceError?: boolean;
  RegExp?: boolean;
  Set?: boolean;
  SharedArrayBuffer?: boolean;
  Storage?: boolean;
  String?: boolean;
  Symbol?: boolean;
  SyntaxError?: boolean;
  TypeError?: boolean;
  URIError?: boolean;
  Uint16Array?: boolean;
  Uint32Array?: boolean;
  Uint8Array?: boolean;
  Uint8ClampedArray?: boolean;
  WeakMap?: boolean;
  WeakSet?: boolean;
  // Array.isArray()
  'Array.isArray'?: boolean;
  // isClass()
  isClass?: boolean;
  // isFunction()
  isFunction?: boolean;
  // isFinite()
  isFinite?: boolean;
  // isInteger()
  'Number.isInteger'?: boolean;
  // isNaN()
  isNaN?: boolean;
  // Number.isNaN()
  'Number.isNaN'?: boolean;
  // Number.isFinite()
  'Number.isFinite'?: boolean;
  // typeOf()
  typeOf?: string;
  // operator typeof
  typeof?: string;

  [index: string]: boolean | string | undefined;
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/recognize/type/of-recognized.type.ts>" %}


# resultCallback()

## `resultCallback()`

Default function to handle `callback` parameter of functions.

```typescript
const resultCallback = (result: boolean): boolean => result;
```

{% embed url="<https://github.com/angular-package/type/blob/main/src/lib/result-callback.func.ts>" %}

### Parameters

#### `result: boolean`

A value of [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type of the result of the check.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) of the result of the check.


# typeOf()

## `typeOf()`

Gets the specific object type of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value.

{% code title="type-of.func.ts" %}

```typescript
const typeOf = (value: any): string =>
  Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/lib/type-of.func.ts>" %}

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to obtain its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) name.

### Returns

The **return value** is the [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) name of the given [`value`](#value-any).

## Example usage

```typescript
// Example usage.
import { typeOf } from '@angular-package/type';


```


# isArray()

## `isArray()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'array'` or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type and passes the test [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) method.

{% code title="is-array.func.ts" %}

```typescript
const isArray = <Type = any, Payload extends object = object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Array<Type> =>
  callback(
    (typeOf(value) === 'array' || typeof value === 'object') &&
      Array.isArray(value),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-array.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`=`**<mark style="color:green;">**`any`**</mark>

The `Type` generic type variable indicates the [`array`](https://www.typescriptlang.org/docs/handbook/basic-types.html#array) element type of the given [`value`](#value-any) via the [return type](#return-type), by default is [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isArray()`](#isarray) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Array<Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) because of used the `is` operator indicating the value is an [`array`](https://www.typescriptlang.org/docs/handbook/basic-types.html#array) that takes generic type variable [`Type`](#type-any) by default of value [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) as the type of its elements.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).

## Example usage

### Basic example

```typescript
// Basic example.
import { isArray } from '@angular-package/type'; 

const ARRAY_NUMBER = [1, 2, 3];
const ARRAY_STRING = ['a', 'b', 'c'];

isArray(ARRAY_NUMBER); // Returns `true` as `value is any[]`
isArray<string>(ARRAY_STRING); // Returns `true` as `value is string[]`
```

### Fake `array`

```typescript
// Fake array example.
import { isArray } from '@angular-package/type'; 

const fakeArray = new String('');

Object.assign(fakeArray, {
  get [Symbol.toStringTag](): string {
    return 'array';
  }
});

isArray(fakeArray), // false
typeOf(fakeArray), // "array"
typeof fakeArray, // "object"
Array.isArray(fakeArray) // false
```

### Parameters `callback` and `payload`

```typescript
// Example usage with callback and payload.
import { isArray } from '@angular-package/type';

isArray([1, 2, 3], (result, value, payload) => {
  if (result === true) {
    // Returns `(3) [1, 2, 3]`
    value

    if (payload) {
      // Returns `{ "1": "First", "2": "Second", "3": "Third" }`
      payload.transform;
    }
  }
  return result;
  // Returns `true` as `value is any[]`
}, { transform: { 1: 'First', 2: 'Second', 3: 'Third'} }); 
```


# isBigInt()

## `isBigInt()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

{% code title="is-big-int.func.ts" %}

```typescript
const isBigInt = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is bigint => callback(typeof value === 'bigint', value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-big-int.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isBigInt()`](#isbigint) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is bigint`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided `value` is a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt).

## Example usage

```typescript
// Basic example usage.
import { isBigInt } from '@angular-package/type';

isBigInt(27); // Returns `false` as `value is bigint`
isBigInt(9007199254740991n); // Returns `true` as `value is bigint`
```


# isBoolean()

## `isBoolean()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type, or the obtained type from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'boolean'`, or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type and an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) that is equal to `true` or `false`.

{% code title="is-boolean.func.ts" %}

```typescript
const isBoolean = <
  Type extends AnyBoolean = boolean,
  Payload extends object = object
>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Type =>
  callback(
    (typeof value === 'boolean' ||
    typeOf(value) === 'boolean' ||
    (typeof value === 'object' && value instanceof Boolean)) &&
    (value.valueOf() === true || value.valueOf() === false),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-boolean.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyBoolean`**</mark>**`=`**<mark style="color:green;">**`boolean`**</mark>

The `Type` generic type variable constrained by generic type [`AnyBoolean`](/type-draft/type/anyboolean) by default of [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) indicates the type of the given [`value`](#value-any) via the [return type](#return-type).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isBoolean()`](#isboolean) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement, indicating the [`value`](#value-any) is a generic type variable [`Type`](#typeextendsanyboolean-boolean) constrained by [`AnyBoolean`](/type-draft/type/anyboolean) by default equal to the [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

### Basic example

```typescript
// Basic example usage.
import { isBoolean } from '@angular-package/type';

isBoolean(false); // Returns `true` as `value is boolean`
isBoolean(new Boolean(false)); // Returns `true` as `value is boolean`
```

### Parameters `callback` and `payload`&#x20;

```typescript
// Callback and payload parameters example usage.
import { isBoolean } from '@angular-package/type';

isBoolean('my name', (result, value, payload) => {
  if (result === false) {
    value // "my name"
    if (payload) {
      // Change the result from `false` to `true`.
      if (payload === payload.accepted) {
        result = true;
      }
    }
  }
  return result;
}, { accepted: 'my name' }); // Returns `true` as `value is boolean`.
```

### `String` as `boolean`

```typescript
// String as boolean example usage.
import { isBoolean } from '@angular-package/type';

const fakeBoolean = new String('');

Object.assign(fakeBoolean, {
  get [Symbol.toStringTag](): string {
    return 'boolean';
  },
});

isBoolean(fakeBoolean); // false
typeOf(fakeBoolean); // "boolean"
typeof fakeBoolean; // "object"
```

### `Boolean` as `string`

```typescript
// Boolean as string example.
import { isBoolean } from '@angular-package/type';

const stringAsBoolean = new Boolean('');

Object.assign(stringAsBoolean, {
  get [Symbol.toStringTag](): string {
    return 'string';
  },
});

isBoolean(stringAsBoolean); // true
typeOf(stringAsBoolean); // "string"
typeof stringAsBoolean; // "object"
```


# isBooleanObject()

## `isBooleanObject()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'boolean'` or an `object` type, and an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) and equal `true` or `false`.

{% code title="is-boolean-object.func.ts" %}

```typescript
const isBooleanObject = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Boolean =>
  callback(
    (typeOf(value) === 'boolean' || typeof value === 'object') &&
    value instanceof Boolean &&
    (value.valueOf() === true || value.valueOf() === false),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-boolean-object.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isBooleanObject()`](#isbooleanobject) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Boolean`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

```typescript
// Example usage.
import { isBooleanObject } from '@angular-package/type';

isBooleanObject(false); // false
isBooleanObject(new Boolean(false)); // true
```


# isBooleanType()

## `isBooleanType()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`boolean`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type equal to `true` or `false`.

{% code title="is-boolean-type.func.ts" %}

```typescript
const isBooleanType = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is boolean =>
  callback(
    typeof value === 'boolean' && (value === true || value === false),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-boolean-type.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isBooleanType()`](#isbooleantype) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is boolean`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type.

## Example usage

```typescript
// Example usage.
import { isBooleanType } from '@angular-package/type';

isBooleanType(false); // true
isBooleanType(new Boolean(false)); // false
```


# isClass()

## `isClass()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) type or the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'function'` and an instance of [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions). It also confirms it's a [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) by checking whether the [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) converted with [`Function.prototype.toString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString) to `string` contains the word `class` at the beginning.

{% code title="is-class.func.ts" %}

```typescript
const isClass = <Class = Function, Payload extends object = object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Class =>
  callback(
    typeof value === 'function' ||
    (typeOf(value) === 'function' && value instanceof Function)
    ? /class/.test(Function.prototype.toString.call(value).slice(0, 5))
    : false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-class.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Class`**</mark>**`=`**<mark style="color:green;">**`Function`**</mark>

The `Class` generic type variable indicates the [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) type of the given [`value`](#value-any) via the [return type](#return-type), by default [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isClass()`](#isclass) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is`<mark style="color:green;">`Class`</mark>

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Class`](#class-function) by default [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class).

## Example usage

### Basic example

```typescript
// Example usage.
import { isClass } from '@angular-package/type';

class Class { x = 5; }
const FUNC = (x: number): any => x + 5;

isClass<Class>(Class); // Returns `true` as `value is Class`
isClass(FUNC); // Returns `false` as `value is Function`
isClass(() => 5); // Returns `false` as `value is Function`
```

### Callback and payload parameters

```typescript
// Callback and payload parameters example usage.
import { isClass } from '@angular-package/type';

isClass(() => 5, (result, value, payload) => {
  value // Returns `() => 5`
  if (payload) {
    result // Returns `false`
    payload.c // Returns `class Class`
  }
  return result;
}, { c: Class }); // Returns `false` as `value is Function`
```


# isDate()

## `isDate()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'date'` or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type and an instance of [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). It confirms it's a valid date with the [`isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN) function.

{% code title="is-date.func.ts" %}

```typescript
const isDate = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Date =>
  callback(
    (typeOf(value) === 'date' || typeof value === 'object') &&
    value instanceof Date === true &&
    !isNaN(value),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-date.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isDate()`](#isdate) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Date`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement, indicating the [`value`](#value-any) is a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

## Example usage

### Basic example

```typescript
// Example usage.
import { isDate } from '@angular-package/type';

const DATE = new Date(1995, 11, 17, 3, 24, 0);

isDate(new Date('December 17, 1995 03:24:00')), // true
isDate(new Date('1995-12-17T03:24:00')), // true
isDate(new Date(1995, 11, 17)), // true
isDate(new Date(628021800000)), // true
isDate(DATE); // Returns `true` as `value is Date`
```

### Parameters `callback` and `payload`

```typescript
// Callback and payload parameters example usage.
import { isDate } from '@angular-package/type';

isDate(DATE, (result, payload) => {
  if (payload) {
    result // Returns `true`
    payload.value // Returns new date
    payload.birthDay // Returns `14`
  }
  return result;
}, { birthDay: 14 }); // Returns `true` as `value is Date`
```


# isDefined()

## `isDefined()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is not an [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined) type and is **not** equal to [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined).

{% code title="is-defined.func.ts" %}

```typescript
const isDefined = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Defined<Type> =>
  callback(typeof value !== 'undefined' && value !== undefined, value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-defined.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable indicates the captured type of the given [`value`](#value-type) except [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined), which changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never), via the [return type](#return-type) and the [`value`](/type-draft/type/resultcallback#value-value) type of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.&#x20;

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isDefined()`](#isdefined) function from which it captures its value.

### Parameters

#### `value: Type`

The value of a generic type variable [`Type`](#type), by default of type captured from itself, to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Defined<Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Defined`](/type-draft/type/defined) that takes a generic type variable [`Type`](#type) of value by default equal to the type captured from the supplied [`value`](#value-type) parameter excepts [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) which changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is defined, not [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined).

## Example usage

```typescript
// Example usage.
import { isDefined } from '@angular-package/type';

const UNDEFINED = undefined;
let defined;

isDefined(UNDEFINED); // Returns `false` as `value is never`
isDefined(defined); // Returns `false` as `value is never`
isDefined(27); // Returns `true` as `value is number`
isDefined('age'); // Returns `true` as `value is string`
```

### Parameters `callback` and `payload`

```typescript
// Callback and payload parameters example usage.
import { isDefined } from '@angular-package/type';

isDefined('age', (result, value, payload) => {
  value // 'age'
  if (payload) {
    result // Returns `true`
    payload.notDefined // Returns `false`
  }
  return result;
}, { notDefined: false }); // Returns `true` as `value is string`
```


# ★ isFalse()

Checks if any value is a \`boolean\` type or an instance of \`Boolean\`.

## `isFalse()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) by using [`isBoolean()`](/type-draft/is/isboolean) function, that is equal to `false`.

{% code title="is-false.func.ts" %}

```typescript
const isFalse = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is false =>
  callback(
    isBoolean(value) ? value.valueOf() === false : false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-false.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isFalse()`](#isfalse) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is false`

The **return type** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) as the result of its statement, indicating the [`value`](#value-any) is equal to `false`.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) that is equal to `false`.

## Example usage

```typescript
// Example usage.
import { isFalse } from '@angular-package/type';

isFalse(true); // Returns `false` as `value is false`
isFalse(false); // Returns `true` as `value is false`

isFalse(new Boolean(true)); // Returns `false` as `value is false`
isFalse(new Boolean(false)); // Returns `true` as `value is false`
```

### Parameters `callback` and `payload`

```typescript
// Callback and payload parameters example usage.
import { isFalse } from '@angular-package/type';

isFalse(new Boolean(false), (result, value, payload) => {
  value // Returns `Boolean {false}`
  if (payload) {
    result // Returns `false`
    payload.age // Returns `27`
  }
  return result;
}, { age: 27 }); // Returns `true` as `value is false
```

## StackBlitz

{% embed url="<https://stackblitz.com/edit/typescript-kppsh9?file=index.ts>" %}


# isFunction()

## `isFunction()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions) type or the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'function'` and an instance of [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions). It also denies it's a [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) by checking whether the function converted with [`Function.prototype.toString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString) to the [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) does not contain the word [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) at the beginning.

{% code title="is-function.func.ts" %}

```typescript
const isFunction = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Function =>
  callback(
    typeof value === 'function' ||
      (typeOf(value) === 'function' && (value as any) instanceof Function)
      ? /class/.test(Function.prototype.toString.call(value).slice(0, 5)) ===
          false
      : false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-function.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isFunction()`](#isfunction) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Function`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions).

## Example usage

```typescript
// Example usage.
import { isFunction } from '@angular-package/type';

class Class { x = 5; }
const FUNC = (x: number): any => x + 5;

isFunction(Class); // Returns `false` as `value is typeof Class`, it must not be a `class`.
isFunction(FUNC); // Returns `true` as `value is (x: number) => any`
isFunction(() => 5); // Returns `true` as `value is () => 5`
```

### Parameters `callback` and `payload`

```typescript
// Example usage with callback and payload.
import { isFunction } from '@angular-package/type';

isFunction(() => 5, (result, value, payload) => {
  value // Returns `() => 5`
  if (payload) {
    payload.number // Returns `true`
  }
  return result;
}, { number: true }); // Returns `true` as `value is () => 5`
```


# isInstance()

## `isInstance()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an instance of a given [`constructor`](#constructor-constructor-less-than-obj-greater-than).

{% code title="is-instance.func.ts" %}

```typescript
const isInstance = <Obj, Payload extends object>(
  value: any,
  constructor: Constructor<Obj>,
  callback: ResultCallback<
    any,
    { ctor: typeof constructor } & Payload
  > = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    isObject(value) &&
      typeof constructor === 'function' &&
      constructor instanceof Function
      ? value instanceof constructor
      : false,
    value,
    { ...payload, ctor: constructor } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-instance.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Obj`</mark>

A generic type variable `Obj`, by default captured from the provided [`constructor`](#constructor-constructor-less-than-obj-greater-than), indicates the type of generic type [`Constructor`](/type-draft/type/constructor), and the type of [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-ctor-typeof-constructor-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isInstance()`](#isinstance) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to be an instance of a given [`constructor`](#constructor-constructor-less-than-obj-greater-than).

#### `constructor: Constructor<Obj>`

A [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) or [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions) that specifies the type of [`Constructor`](/type-draft/type/constructor).

#### `callback: ResultCallback<any, { ctor: typeof constructor } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](/type-draft/type/resultcallback) function consists of the [`ctor`](#constructor-constructor-less-than-obj-greater-than) property  given in the [`constructor`](#constructor-constructor-less-than-obj-greater-than) parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-ctor-typeof-constructor-and-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement, indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj) by default of type captured from the supplied [`constructor`](#constructor-constructor-less-than-obj-greater-than).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an instance of a given [`constructor`](#constructor-constructor-less-than-obj-greater-than).

## Example usage

### Basic usage

```typescript
// Example usage.
import { isInstance } from '@angular-package/type';

// Classes.
class Some { x = 127; }
class Two { y = 'Lorem ipsum'; }

const SOME = new Some();
const TWO = new Two();

isInstance(TWO, Some); // false
isInstance(SOME, Some); // true
isInstance<Some, object>(TWO, Two); // true and type error

isInstance(new Array(), Array), // Returns `true` as `value is Array`
isInstance(new Boolean(), Boolean), // Returns `true` as `value is Boolean`
isInstance(new Date(), Date), // Returns `true` as `value is Date`
isInstance(new Error(), Error), // Returns `true` as `value is Error`
isInstance(new Function(), Function), // Returns `true` as `value is Function`
isInstance(new Map(), Map), // Returns `true` as `value is Map`
isInstance(new Number(), Number), // Returns `true` as `value is Number`
isInstance(new Object(), Object), // Returns `true` as `value is Object`
isInstance(new RegExp(/^[]/), RegExp), // Returns `true` as `value is RegExp`
isInstance(new Set(), Set), // Returns `true` as `value is Set`
isInstance(new String(), String), // Returns `true` as `value is String`
```

### Parameters `callback` and `payload`&#x20;

```typescript
// Example usage with callback and payload.
import { isInstance } from '@angular-package/type';

// Classes.
class Some { x = 127; }
class Two { y = 'Lorem ipsum'; }

const SOME = new Some();
const TWO = new Two();

isInstance(TWO, Some, (result, value, payload) => {
  value // Returns the provided `Two`
  if (payload) {
    payload.className // Returns `'Some'`
    payload.ctor // Returns the provided `Some`
  }
  return result;
}, { className: Some });
```

### Function constructor

```typescript
// Example usage with function constructor.
import { isInstance } from '@angular-package/type';

// Function constructor.
function functionConstructor(this: any, ...args: any[]): any {
  if (args) {
    args.forEach((arg, index: number) => this[index] = arg[index]);
  }
  return this;
}

const anyInstance: any = new (functionConstructor as any)('First name', 'Sur name', 27);
isInstance(anyInstance, functionConstructor as any); // true
```


# isKey()

## `isKey()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is one of the [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), or [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

{% code title="is-key.func.ts" %}

```typescript
const isKey = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is PropertyKey =>
  callback(
    isStringType(value) || isNumberType(value) || isSymbol(value),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-key.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isKey()`](#iskey) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is PropertyKey`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is `PropertyKey`.

### Returns

The **return value** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) indicating whether the provided [`value`](#value-any) is a `PropertyKey`.

## Example usage

### Key of `string`

```typescript
// Example string usage.
import { isKey } from '@angular-package/type';

const STRING = 'surname';
const STRING_INSTANCE = new String(STRING);
isKey(STRING); // true
isKey(STRING_INSTANCE); // true
```

### Key of `number`

```typescript
// Example number usage.
import { isKey } from '@angular-package/type';

const NUMBER = 27;
const NUMBER_INSTANCE = new Number(NUMBER);
isKey(NUMBER); // true
isKey(NUMBER_INSTANCE); // true
```

### Key of `symbol`

```typescript
// Example symbol usage.
import { isKey } from '@angular-package/type';

const STRING = 'surname';
const NUMBER = 27;

const SYMBOL_NUMBER: unique symbol = Symbol(NUMBER);
const SYMBOL_STRING: unique symbol = Symbol(STRING);

isKey(SYMBOL_NUMBER); // true
isKey(SYMBOL_STRING); // true
```


# isNull()

## `isNull()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'null'` or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type that is equal to [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

{% code title="is-null.func.ts" %}

```typescript
const isNull = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is null =>
  callback(
    (typeOf(value) === 'null' || typeof value === 'object') && value === null,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-null.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNull()`](#isnull) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is null`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

## Example usage

```typescript
// Example usage.
import { isNull } from '@angular-package/type';

isNull(null); // true
isNull(27); // false
```


# ★ isNumber()

## `isNumber()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type, or the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'number'` or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type and an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number). The value is also checked by the [`Number.isFinite()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite) method to determine whether it's finite and is validated by the [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) method.

{% code title="is-number.func.ts" %}

```typescript
const isNumber = <
  Type extends AnyNumber = number,
  Payload extends object = object
>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Type =>
  callback(
    (typeof value === 'number' ||
      ((typeOf(value) === 'number' || typeof value === 'object') &&
        value instanceof Number)) &&
      !Number.isNaN(value.valueOf()) &&
      Number.isFinite(value.valueOf()),
    value,
    payload
  );xz
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-number.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Type`</mark>`extends`<mark style="color:green;">`AnyNumber`</mark>`=`<mark style="color:green;">`number`</mark>

A generic type variable `Type` constrained by [`AnyNumber`](/type-draft/type/anynumber) indicates the number type of the given [`value`](#value-any) via the [return type](#return-type), by default [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional  [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNumber()`](#isnumber) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Type`](#type) constrained by [`AnyNumber`](/type-draft/type/anynumber) by default of [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

## Example usage

```typescript
// Example usage.
import { isNumber } from '@angular-package/type';

isNumber(10304050); // true, value is number
isNumber(Number(10304050)); // true, value is number
isNumber(new Number(10304050)); // true, value is number
isNumber<Number>(new Number(10304050)); // true, value is Number
```


# isNumberBetween()

## `isNumberBetween()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)(by using [`isNumber()`](/type-draft/is/isnumber)) between a specified range.

{% code title="is-number-between.func.ts" %}

```typescript
const isNumberBetween = <
  Type extends AnyNumber = number,
  Min extends number = number,
  Max extends number = number,
  Payload extends object = object
>(
  value: any,
  min: Min,
  max: Max,
  callback: ResultCallback<
    any,
    { min: Min; max: Max } & Payload
  > = resultCallback,
  payload?: Payload
): value is NumberBetween<Min, Max, Type> =>
  callback(
    isNumber(value)
      ? (isNumberType(min) ? value.valueOf() >= min : false) &&
          (isNumberType(max) ? value.valueOf() <= max : false)
      : false,
    value,
    { ...payload, min, max } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-number-between.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Type`</mark>`extends`<mark style="color:green;">`AnyNumber`</mark>`=`<mark style="color:green;">`number`</mark>

A generic type variable `Type` constrained by [`AnyNumber`](/type-draft/type/anynumber) indicates the number type of the given [`value`](#value-any) via the [return type](#return-type), by default [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number).

#### <mark style="color:green;">`Min`</mark>`extends`<mark style="color:green;">`number`</mark>`=`<mark style="color:green;">`number`</mark>

A generic type variable `Min` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type, by default of value captured from the supplied [`min`](#min-min) indicates the **minimum** range of the provided [`value`](#value-any) via the [return type](#return-type) and the fixed shape of optional [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the provided [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function.

#### <mark style="color:green;">`Max`</mark>`extends`<mark style="color:green;">`number`</mark>`=`<mark style="color:green;">`number`</mark>

A generic type variable `Max` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type, by default of value captured from the supplied [`max`](#max-max) indicates the **maximum** range of the provided [`value`](#value-any) via the [return type](#return-type) and the fixed shape of optional [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the provided [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNumberBetween()`](#isnumberbetween) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `min: Min`

The **minimum** range of generic type variable [`Min`](#minextendsnumber-number) for a given [`value`](#value-any).

#### `max: Max`

The **maximum** range of generic type variable [`Max`](#maxextendsnumber-number) for a given [`value`](#value-any).

#### `callback: ResultCallback<any, { min: Min; max: Max } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](/type-draft/type/resultcallback) function consists of the [`min`](#min-min) and [`max`](#max-max) properties given in parameters of the core function, and they can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function.

### Return type

#### `value is NumberBetween<Min, Max, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type [`NumberBetween`](/type-draft/type/numberbetween) that takes generic type variables [`Min`](#minextendsnumber-number) and [`Max`](#maxextendsnumber-number) as a **range** of the supplied [`value`](#value-any) and [`Type`](#typeextendsanynumber-number) as the type of the supplied [`value`](#value-any).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the [`value`](#value-any) is a finite [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) of a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) between a specified range.

## Example usage

### Type

```typescript
// Example usage.
import { isNumberBetween } from '@angular-package/type';

const age = 13;

// true; The return type `value is NumberBetween<0, 13, number>`
isNumberBetween(age, 0, 13);
// false; The return type `value is NumberBetween<14, 28, number>`
isNumberBetween(age, 14, 28);
// false; The return type `value is NumberBetween<0, 12, number>`
isNumberBetween(age, 0, 12);
// true; The return type `value is NumberBetween<13, 13, number>`
isNumberBetween(age, 13, 13);
```

### Instance

```typescript
// Example usage.
import { isNumberBetween } from '@angular-package/type';

const ageBox = new Number(age);

// true; The return type `value is NumberBetween<0, 13, Number>`
isNumberBetween(ageBox, 0, 13);
// false; The return type `value is NumberBetween<14, 28, Number>`
isNumberBetween(ageBox, 14, 28);
// false; The return type `value is NumberBetween<0, 12, Number>`
isNumberBetween(ageBox, 0, 12);
// true; The return type `value is NumberBetween<13, 13, Number>`
isNumberBetween(ageBox, 13, 13);
```


# isNumberObject()

## `isNumberObject()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'number'`, or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type and an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) and **finite** by using the [`Number.isFinite()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite) method and is **valid** by using the [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) method.

{% code title="is-number-object.func.ts" %}

```typescript
const isNumberObject = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Number =>
  callback(
    (typeOf(value) === 'number' || typeof value === 'object') &&
      value instanceof Number &&
      !Number.isNaN(value.valueOf()) &&
      Number.isFinite(value.valueOf()),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-number-object.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNumberObject()`](#isnumberobject) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Number`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is [`Number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the [`value`](#value-any) is an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

```typescript
// Example usage.
import { isNumberObject } from '@angular-package/type';

isNumberObject(10304050); // false
isNumberObject(Number(10304050)); // false
isNumberObject(new Number(10304050)); // true
```


# isNumberType()

## `isNumberType()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type and finite by using the [`Number.isFinite()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite) method and valid by the [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) method.

{% code title="is-number-type.func.ts" %}

```typescript
const isNumberType = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is number =>
  callback(
    typeof value === 'number' && Number.isFinite(value) && !Number.isNaN(value),
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-number-type.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNumberType()`](#isnumbertype) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is number`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the provided [`value`](#value-any) is a [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type.

## Example usage

```typescript
// Example usage.
import { isNumberType } from '@angular-package/type';

isNumberType(10304050); // true
isNumberType(Number(10304050)); // true
isNumberType(new Number(10304050)); // false
```


# isObject()

## `isObject()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type or the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'object'`, and an instance of [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object).

{% code title="is-object.func.ts" %}

```typescript
const isObject = <Obj = object, Payload extends object = object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    (typeof value === 'object' || typeOf(value) === 'object') &&
      value instanceof Object,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Obj`</mark>`=`<mark style="color:green;">`object`</mark>

A generic type variable `Obj` indicates the type of the given [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`, by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isObject()`](#isobject) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj-object) by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object).

## Example usage

```typescript
// Example usage.
import { isObject } from '@angular-package/type';

const x = 10304050;
const NUMBER = 10304050;
const STRING = '!@#$%^&*()abcdefghijklmnoprstuwyz';
const SYMBOL_NUMBER: unique symbol = Symbol(NUMBER);
const SYMBOL_STRING: unique symbol = Symbol(STRING);

interface ObjectOne {
  'key as string'?: boolean;
  1030405027?: string;
  5?: string;
  [NUMBER]: number;
  [STRING]: string;
  [SYMBOL_NUMBER]?: string;
  [SYMBOL_STRING]?: number;
  x: number;
}

const OBJECT_ONE: ObjectOne = {
  'key as string': true,
  1030405027: 'key is number',
  5: 'key is also number',
  [NUMBER]: NUMBER,
  [STRING]: 'key is string',
  [SYMBOL_NUMBER]: 'key is symbol number',
  [SYMBOL_STRING]: 6,
  x: 3000
};

isObject(OBJECT_ONE); // true
```


# isObjectKey()

## `isObjectKey()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)(by using the [`isObject()`](/type-draft/is/isobject)) function with its **key** of the `PropertyKey` type.

{% hint style="info" %}
The function uses the [`hasOwnProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) method of [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) to find enumerable and non-enumerable `PropertyKey` as string, number, symbol unlike [`Object.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) that finds only [enumerable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) property names excluding symbol, but it can't find getter accessor unlike [`in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) operator, which can. To find also getter accessors use the [`isObjectKeyIn()`](/type-draft/is/isobjectkeyin) function.
{% endhint %}

{% code title="is-object-key.func.ts" %}

```typescript
const isObjectKey = <
  Obj extends object,
  Payload extends object = object
>(
  value: any,
  key: PropertyKey,
  callback: ResultCallback<any, { key: typeof key } & Payload> = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    isObject(value) ? {}.hasOwnProperty.call(value, key) : false,
    value,
    { ...payload, key } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object-key.func.ts>" %}

### Generic type variables

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

A generic type variable `Obj` indicates the type of [`value`](#value-any) parameter by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) via the [return type](#return-type) `value is Obj`.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-key-typeof-key-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isObjectKey()`](#isobjectkey) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains a key from a given [`key`](#key-propertykey).

#### `key: PropertyKey`

A property key to check if a given [`value`](#value-any) contains.

#### `callback: ResultCallback<any, { key: typeof key } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-key-typeof-key-and-payload-greater-than) function consists of the [`key`](#key-propertykey) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-key-typeof-key-and-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement, indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj) by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with its [`key`](#key-propertykey).

## Example usage

```typescript
// Example usage.
import { isObjectKey } from '@angular-package/type';

const NUMBER = 10304050;
const STRING = '!@#$%^&*()abcdefghijklmnoprstuwyz';
const SYMBOL_NUMBER: unique symbol = Symbol(NUMBER);
const SYMBOL_STRING: unique symbol = Symbol(STRING);

interface ObjectOne {
  'key as string'?: boolean;
  1030405027?: string;
  5?: string;
  [NUMBER]: number;
  [STRING]: string;
  [SYMBOL_NUMBER]?: string;
  [SYMBOL_STRING]?: number;
  x: number;
}
const OBJECT_ONE: ObjectOne = {
  'key as string': true,
  1030405027: 'key is number',
  5: 'key is also number',
  [NUMBER]: NUMBER,
  [STRING]: 'key is string',
  [SYMBOL_NUMBER]: 'key is symbol number',
  [SYMBOL_STRING]: 6,
  x: 3000
};
isObjectKey(OBJECT_ONE, STRING); // true
isObjectKey(OBJECT_ONE, 1030405027); // true
isObjectKey(OBJECT_ONE, NUMBER); // true
isObjectKey(OBJECT_ONE, SYMBOL_NUMBER); // true
isObjectKey(OBJECT_ONE, SYMBOL_STRING); // true

class Class {

  1030405027 = 'my new number';
  5 = 'my number';

  firstName = 'My name';
  surname = 'Surname';

  x = NUMBER;
  y = STRING;

  get [NUMBER](): number {
    return this.x;
  }
  get [STRING](): string {
    return this.y;
  }

  get [SYMBOL_NUMBER](): number {
    return this.x;
  }

  get [SYMBOL_STRING](): string {
    return this.y;
  }
}

const CLASS = new Class();

// One of the differences between the `in` operator and the `hasOwnProperty()`
// method is that it doesn't find a getter key
isObjectKey(CLASS, SYMBOL_NUMBER); // false
isObjectKey(CLASS, SYMBOL_STRING); // false
```


# isObjectKeyIn()

## `isObjectKeyIn()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)(by using the [`isObject()`](/type-draft/is/isobject)) with a key of the `PropertyKey` in it(or its prototype chain) by using the [`in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) operator.

{% code title="is-object-key-in.func.ts" %}

```typescript
const isObjectKeyIn = <Obj = object, Payload extends object = object>(
  value: any,
  key: PropertyKey,
  callback: ResultCallback<any, { key: typeof key } & Payload> = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(isObject(value) ? key in value : false, value, {
    ...payload,
    key,
  } as any);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object-key-in.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Obj`</mark>`=`<mark style="color:green;">`object`</mark>

A generic type variable `Obj` indicates the type of [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`, by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#payloadextendsobject-object) function and [`payload`](#payload-payload) optional parameter of the [`isObjectKeyIn()`](#isobjectkeyin) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check against an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains(or its prototype chain) a key from a given [`key`](#key-propertykey).

#### `key: PropertyKey`

A property key to check if a given [`value`](#value-any) contains(or its prototype chain).

#### `callback: ResultCallback<any, { key: typeof key } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-key-typeof-key-payload-greater-than) function consists of the [`key`](#key-propertykey) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj-object) by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains(or its prototype chain) a given [`key`](#key-propertykey).

## Example usage

```typescript
// Example usage.
import { isObjectKeyIn } from '@angular-package/type';

const NUMBER = 10304050;
const STRING = '!@#$%^&*()abcdefghijklmnoprstuwyz';
const SYMBOL_NUMBER: unique symbol = Symbol(NUMBER);
const SYMBOL_STRING: unique symbol = Symbol(STRING);

class Class {

   1030405027 = 'my new number';
   5 = 'my number';

   firstName = 'My name';
   surname = 'Surname';

   x = NUMBER;
   y = STRING;

   get [NUMBER](): number {
     return this.x;
   }
   get [STRING](): string {
     return this.y;
   }

   get [SYMBOL_NUMBER](): number {
     return this.x;
   }

   get [SYMBOL_STRING](): string {
     return this.y;
   }
}

const CLASS = new Class();

// One of the differences between `in` operator and the `hasOwnProperty()`
// method is that it finds a getter key
isObjectKeyIn(CLASS, SYMBOL_NUMBER); // true
isObjectKeyIn(CLASS, SYMBOL_STRING); // true
```


# isObjectKeys()

## `isObjectKeys()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)(by using the [`isObject()`](/type-draft/is/isobject)) with its [`keys`](#keys-propertykey) by using [`hasOwnProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) method of [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object).

{% hint style="info" %}
The function uses the [`hasOwnProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) method of [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) to find enumerable and non-enumerable `PropertyKey` as string, number, symbol unlike [`Object.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) that finds only [enumerable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) property names excluding symbol, but it can't find getter accessor unlike [`in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) operator, which can. To find also getter accessors use the [`isObjectKeysIn()`](/type-draft/is/isobjectkeysin) function.
{% endhint %}

{% code title="is-object-keys.func.ts" %}

```typescript
const isObjectKeys = <Obj = object, Payload extends object = object>(
  value: any,
  keys: PropertyKey[],
  callback: ResultCallback<
    any,
    { keys: typeof keys } & Payload
  > = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    isObject(value) && isArray(keys)
      ? keys.every((key) => ({}.hasOwnProperty.call(value, key)))
      : false,
    value,
    { ...payload, keys } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object-keys.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Obj`</mark>`=`<mark style="color:green;">`object`</mark>

A generic type variable `Obj` indicates the type of the given [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`, by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isObjectKeys()`](#isobjectkeys) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains its keys from given [`keys`](#keys-propertykey).

#### `keys: PropertyKey[]`

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of property keys to check if a given [`value`](#value-any) contains.

#### `callback: ResultCallback<any, { keys: typeof keys } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function consists of the [`keys`](#keys-propertykey) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj-object) by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with its [`keys`](#keys-propertykey).

## Example usage

```typescript
// Example usage.
import { isObjectKeys } from '@angular-package/type';

class Person {
  firstName = 'name';
  surname = 'surname';
  age = 27;
  city = 'New York';
  sex = 'Male';
  get getAge(): number {
    return this.age;
  }
}
const person = new Person();
// Define property.
Object.defineProperty(person, 'notEnumerable', { enumerable: false });

person.propertyIsEnumerable('notEnumerable'); // Returns `false`.
isObjectKeys(person, ['firstName']); // Returns `true` as `value is object`.
isObjectKeys(person, ['firstName', 'surname']); // Returns `true` as `value is object`.
isObjectKeys(person, ['firstName', 'no property']); // Returns `false` as `value is object`.
// Getter.
isObjectKeys(person, ['getAge']); // Returns `false` as `value is object`.
// not enumerable.
isObjectKeys(person, ['notEnumerable']); // Returns `true` as `value is object`.
/*
  Returns [
    "firstName",
    "surname",
    "age",
    "city",
    "sex"
]
*/
Object.keys(person);
```


# isObjectKeysIn()

## `isObjectKeysIn()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)(by using the [`isObject()`](/type-draft/is/isobject)) with [`keys`](#keys-propertykey) of the `PropertyKey` in it(or its prototype chain) by using the [`in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) operator.

{% code title="is-object-keys-in.func.ts" %}

```typescript
const isObjectKeysIn = <Obj = object, Payload extends object = object>(
  value: any,
  keys: PropertyKey[],
  callback: ResultCallback<
    any,
    { keys: typeof keys } & Payload
  > = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    isObject(value) && isArray(keys) ? keys.every((k) => k in value) : false,
    value,
    { ...payload, keys } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object-keys-in.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Obj`</mark>`=`<mark style="color:green;">`object`</mark>

A generic type variable `Obj` indicates the type of the given [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`, by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isObjectKeysIn()`](#isobjectkeysin) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against the [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains(or its prototype chain) keys from the given [`keys`](#keys-propertykey).

#### `keys: PropertyKey[]`

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of property keys to check if a given [`value`](#value-any) contains(or its prototype chain).

#### `callback: ResultCallback<any, { keys: typeof keys } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function consists of the [`keys`](#keys-propertykey) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj-object) by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains(or its prototype chain) given [`keys`](#keys-propertykey).

## Example usage

```typescript
// Example usage.
import { isObjectKeysIn } from '@angular-package/type';

class Person {
  firstName = 'name';
  surname = 'surname';
  age = 27;
  city = 'New York';
  sex = 'Male';
  get getAge(): number {
    return this.age;
  }
}
const person = new Person();
// Define property.
Object.defineProperty(person, 'notEnumerable', { enumerable: false });
person.propertyIsEnumerable('notEnumerable'); // Returns `false`.
isObjectKeysIn(person, ['firstName']); // Returns `true` as `value is object`.
isObjectKeysIn(person, ['firstName', 'surname']); // Returns `true` as `value is object`.
isObjectKeysIn(person, ['firstName', 'no property']); // Returns `false` as `value is object`.
// Getter.
isObjectKeysIn(person, ['getAge']); // Returns `true` as `value is object`.
// not enumerable.
isObjectKeysIn(person, ['notEnumerable']); // Returns `true` as `value is object`.
```


# isObjectSomeKeys()

## `isObjectSomeKeys()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)(by using the [`isObject()`](/type-draft/is/isobject)) with some of its keys or some groups of its keys of the `PropertyKey` type.

{% hint style="info" %}
The two-dimensional `Array` of the given [`value`](#value-any) is an [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [`Arrays`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) where the relation between elements of the first [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) is a logical **OR**, and the relationship between elements of the second [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) is a logical **AND**.

The logical **OR** results from the use of the [`some()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) method of the [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), and a logical **`AND`** result from [`every()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
{% endhint %}

{% code title="is-object-some-keys.func.ts" %}

```typescript
const isObjectSomeKeys = <
  Obj extends object,
  Payload extends object = object
>(
  value: any,
  keys: (PropertyKey | PropertyKey[])[],
  callback: ResultCallback<
    any,
    { keys: typeof keys } & Payload
  > = resultCallback,
  payload?: Payload
): value is Obj =>
  callback(
    isObject(value) && isArray(keys)
      ? keys.some((someKey) =>
          isArray(someKey)
            ? someKey.every((everyKey) =>
                ({}.hasOwnProperty.call(value, everyKey))
              )
            : {}.hasOwnProperty.call(value, someKey) === true
        )
      : false,
    value,
    { ...payload, keys } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-object-some-keys.func.ts>" %}

### Generic type variables

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

A generic type variable `Obj` constrained by the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of the given [`value`](#value-any) parameter via the [return type](#return-type) `value is Obj`, by default [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isObjectSomeKeys()`](#isobjectsomekeys) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) that contains some of its keys or some groups of its keys from a given [`keys`](#keys-propertykey-or-propertykey).

#### `keys: (PropertyKey | PropertyKey[])[]`

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of property names or a two-dimensional [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of property names to check if the given [`value`](#value-any) contains some of them or some groups of them.

#### `callback: ResultCallback<any, { keys: typeof keys } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function consists of the [`keys`](#keys-propertykey-or-propertykey) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-keys-typeof-keys-and-payload-greater-than) function.

### Return type

#### `value is Obj`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Obj`](#obj-extends-object) by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with some of its keys or some groups of its keys from a given [`keys`](#keys-propertykey-or-propertykey).

## Example usage

```typescript
// Example usage.
import { isObjectSomeKeys } from '@angular-package/type';

class Person {
  firstName = 'name';
  surname = 'surname';
  age = 27;
  city = 'New York';
  sex = 'Male';
  get getAge(): number {
    return this.age;
  }
}
const person = new Person();
// Define property.
Object.defineProperty(person, 'notEnumerable', { enumerable: false });
person.propertyIsEnumerable('notEnumerable'); // Returns `false`.
isObjectSomeKeys(person, ['firstName']); // Returns `true` as `value is object`.
isObjectSomeKeys(person, ['firstName', 'surname']); // Returns `true` as `value is object`.
isObjectSomeKeys(person, ['firstName', 'no property']); // Returns `true` as `value is object`.
// Getter.
isObjectSomeKeys(person, ['getAge']); // Returns `false` as `value is object`.
// not enumerable.
isObjectSomeKeys(person, ['notEnumerable']); // Returns `true` as `value is object`.
isObjectSomeKeys(person, [['firstName', 'surname'], ['city', 'age']]); // Returns `true` as `value is object`.
isObjectSomeKeys(person, [['firstName', 'surname'], ['city', 'no property']]); // Returns `true` as `value is object`.
isObjectSomeKeys(person, [['firstName1', 'surname1'], ['city1', 'no property']]); // Returns `false` as `value is object`.
```


# isPrimitive()

## `isPrimitive()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is of the generic type [`Primitive`](/type-draft/type/primitive) or specific type from a given [`type`](#type-primitives) of the generic type [`Primitives`](/type-draft/type/primitives).

{% code title="is-primitive.func.ts" %}

```typescript
const isPrimitive = <
  Type extends Primitive,
  Payload extends object = object
>(
  value: any,
  type?: Primitives,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Type =>
  isStringType(type)
    ? {
        bigint: isBigInt,
        boolean: isBooleanType,
        number: isNumberType,
        null: isNull,
        string: isStringType,
        symbol: isSymbol,
        undefined: isUndefined,
      }[type](value, callback, payload)
    : callback(
        isNull(value) ||
          (typeof value !== 'object' && typeof value !== 'function'),
        value,
        payload
      );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-primitive.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">`Type`</mark>`extends`<mark style="color:green;">`Primitive`</mark>

A generic type variable `Type` constrained by the generic type [`Primitive`](/type-draft/type/primitive) type indicates the type of [`value`](#value-any) parameter via the [return type](#return-type) `value is Type`.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isPrimitive()`](#isprimitive) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `type?: Primitives`

An optional value of the generic type [`Primitives`](/type-draft/type/primitives) type indicates against which type the provided [`value`](#value-any) is checked.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Type`](#typeextendsprimitive) by default equal to [`Primitive`](/type-draft/type/primitive).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a primitive type of the [`Primitives`](/type-draft/type/primitives).

## Example usage

```typescript
// Example usage.
import { isPrimitive } from '@angular-package/type';

isPrimitive(1n); // Returns `true` as `value is Primitive`
isPrimitive<bigint>(1n, 'bigint'); // Returns `true` as `value is bigint`
isPrimitive<boolean>(false, 'boolean'); // Returns `true` as `value is boolean`
isPrimitive<number>(27, 'number'); // Returns `true` as `value is number`
isPrimitive<null>(null, 'null'); // Returns `true` as `value is null`
isPrimitive<string>('age', 'string'); // Returns `true` as `value is string`
isPrimitive<symbol>(Symbol(27), 'symbol'); // Returns `true` as `value is symbol`
isPrimitive<undefined>(undefined, 'undefined'); // Returns `true` as `value is undefined`
```


# isRegExp()

## `isRegExp()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'regexp'`, or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type, and an instance of [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

{% code title="is-reg-exp.func.ts" %}

```typescript
const isRegExp = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is RegExp =>
  callback(
    (typeOf(value) === 'regexp' || typeof value === 'object') &&
      value instanceof RegExp,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-regexp.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isRegExp()`](#isregexp) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is RegExp`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a regular expression of a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).

## Example usage

```typescript
// Example usage.
import { isRegExp } from '@angular-package/type';

isRegExp(/[^a-z]/g); // true; The return type `value is RegExp`
```


# ★ isString()

## `isString()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type(by using the [`isStringType()`](/type-draft/is/isstringtype)) or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) by using the [`isStringObject()`](/type-draft/is/isstringobject) function.

{% code title="is-string.func.ts" %}

```typescript
const isString = <
  Type extends AnyString = string,
  Payload extends object = object
>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is Type =>
  callback(isStringType(value) || isStringObject(value), value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyString`**</mark>**`=`**<mark style="color:green;">**`string`**</mark>

A generic type variable `Type` constrained by [`AnyString`](/type-draft/type/anystring) indicates [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type of the given [`value`](#value-any) via the [return type](#return-type), by default [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isString()`](#isstring) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Type`](#typeextendsanystring-string) by default equal to the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

## Example usage

```typescript
// Example usage.
import { isString } from '@angular-package/type';

isString('age'); // true; The return type `value is string`
isString(new String('age')); // true; The return type `value is string`

// Fake string example.
const fakeString = new Number('asd');

Object.assign(fakeString, {
  get [Symbol.toStringTag](): string {
    return 'string';
  },
});

isString(fakeString); // false
typeOf(fakeString); // "string"
typeof fakeString; // "object"
```


# isStringIncludes()

## `isStringIncludes()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)(by using [`isString()`](/type-draft/is/isstring)) that includes all of the specified **words/sentences**.

{% code title="is-string-includes.func.ts" %}

```typescript
const isStringIncludes = <
  Type extends AnyString = string,
  Payload extends object = object
>(
  value: any,
  includes: string[],
  callback: ResultCallback<
    any,
    { includes: typeof includes } & Payload
  > = resultCallback,
  payload?: Payload
): value is Type =>
  callback(
    isString(value)
      ? isArray(includes)
        ? includes.every((include) => value.valueOf().includes(include))
        : false
      : false,
    value,
    { ...payload, includes } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-includes.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyString`**</mark>**`=`**<mark style="color:green;">**`string`**</mark>

A generic type variable `Type` constrained by generic type [`AnyString`](/type-draft/type/anystring) indicates the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type of the given [`value`](#value-any) via the [return type](#return-type).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringIncludes()`](#isstringincludes) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against the [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) that contains **words/sentences** from a given [`includes`](#includes-string).

#### `includes: string[]`

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) as **words/sentences** to be **case-sensitive** searched for within the given [`value`](#value-any).

#### `callback: ResultCallback<any, { includes: typeof includes } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function consists of the [`includes`](#includes-string) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Type`](#typeextendsanystring-string) by default equal to the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) that includes all of the specified **words/sentences**.

## Example usage

```typescript
// Example usage.
import { isStringIncludes } from '@angular-package/type';

isStringIncludes('This is a person without age.', ['age']); // true; The return type `value is string`
isStringIncludes('This is a person without age.', ['Person']); // false; The return type `value is string`
isStringIncludes('This is a person without age.', ['age', 'Person']); // false; The return type `value is string`
isStringIncludes(new String('This is artificial intelligence.'), [
  'artificial',
  'intelligence',
]); // true; The return type `value is string`
```


# isStringIncludesSome()

## `isStringIncludesSome()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)(by using [`isString()`](/type-draft/is/isstring)) that includes some of the specified **words/sentences**.

{% code title="is-string-inludes-some.func.ts" %}

```typescript
const isStringIncludesSome = <
  Type extends AnyString = string,
  Payload extends object = object
>(
  value: any,
  includes: string[],
  callback: ResultCallback<
    any,
    { includes: typeof includes } & Payload
  > = resultCallback,
  payload?: Payload
): value is Type =>
  callback(
    isString(value)
      ? isArray(includes)
        ? includes.some((include) => value.valueOf().includes(include))
        : false
      : false,
    value,
    { ...payload, includes } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-includes-some.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyString`**</mark>**`=`**<mark style="color:green;">**`string`**</mark>

A generic type variable `Type` constrained by generic type [`AnyString`](/type-draft/type/anystring) indicates the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type of the given [`value`](#value-any) via the [return type](#return-type).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringIncludesSome()`](#isstringincludessome) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against the [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) that [`includes`](#includes-string) **some** of the **words/sentences**.

#### `includes: string[]`

An [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) as **words/sentences** to be **case-sensitive** searched for within a given [`value`](#value-any).

#### `callback: ResultCallback<any, { includes: typeof includes } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function consists of the [`includes`](#includes-string) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-includes-typeof-includes-and-payload-greater-than) function.

### Return type

#### `value is Type`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`Type`](#typeextendsanystring-string) by default [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) that includes some of the specified **words/sentences**.

## Example usage

```typescript
// Example usage.
import { isStringIncludesSome } from '@angular-package/type';

isStringIncludesSome('This is a person without age.', ['age']); // true; The return type `value is string`
isStringIncludesSome('This is a person without age.', ['Person']); // false; The return type `value is string`
isStringIncludesSome('This is a person without age.', ['age', 'Person']); // true; The return type `value is string`
isStringIncludesSome(new String('This is artificial intelligence.'), [
  'artificial',
  'intelligence',
]); // true; The return type `value is string`
```


# isStringLength()

## `isStringLength()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)(by using [`isString()`](/type-draft/is/isstring)) of a specified length.

{% code title="is-string-length.func.ts" %}

```typescript
const isStringLength = <
  Type extends AnyString = string,
  Length extends number = number,
  Payload extends object = object
>(
  value: any,
  length: Length,
  callback: ResultCallback<any, { length: Length } & Payload> = resultCallback,
  payload?: Payload
): value is StringOfLength<Length, Length, Type> =>
  callback(
    isString(value) && isNumberType(length) && length > 0
      ? value.valueOf().length === length
      : false,
    value,
    { ...payload, length } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-length.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyString`**</mark>**`=`**<mark style="color:green;">**`string`**</mark>

A generic type variable `Type` constrained by [`AnyString`](/type-draft/type/anystring) indicates the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type of the given [`value`](#value-any) via the [return type](#return-type).

#### <mark style="color:green;">**`Length`**</mark>**`extends`**<mark style="color:green;">**`number`**</mark>

A generic type variable `Length` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type, by default of value captured from the supplied [`length`](#length-length) indicates the **length** of the provided [`value`](#value-any) via the [return type](#return-type) and the fixed shape of optional [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the provided [`callback`](#callback-resultcallback-less-than-any-length-length-and-payload-greater-than) function.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-length-length-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringLength()`](#isstringlength) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `length: Length`

The **length** of generic type variable [`Length`](#lengthextendsnumber) of a given [`value`](#value-any).

#### `callback: ResultCallback<any, { length: Length } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-length-length-and-payload-greater-than) function consists of the [`length`](#length-length) property given in parameter of the core function, and it can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-length-length-and-payload-greater-than) function.

### Return type

#### `value is StringOfLength<Length, Length, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type [`StringOfLength`](/type-draft/type/stringoflength) that takes generic type variables `Min` and `Max` from the generic type variable [`Length`](#lengthextendsnumber) as the **length** of the supplied [`value`](#value-any), and generic type variable [`Type`](#typeextendsanystring) as the type of the provided [`value`](#value-any).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) of the specified length.

## Example usage

### `string` type

```typescript
// Example usage.
import { isStringLength } from '@angular-package/type';

const firstName = 'my first name';

// true; The return type `value is StringOfLength<13, 13, string>`
isStringLength(firstName, 13);
// false; The return type `value is StringOfLength<12, 12, string>`
isStringLength(firstName, 12);
// false; The return type `value is StringOfLength<14, 13, string>`
isStringLength(firstName, 14);
```

### `String` instance

```typescript
// Example usage.
import { isStringLength } from '@angular-package/type';

const firstName = 'my first name';
const firstNameBox = new String(firstName);

// true; The return type `value is StringOfLength<0, 13, string>`
isStringLength(firstNameBox, 13);
// false; The return type `value is StringOfLength<14, 14, string>`
isStringLength(firstNameBox, 14);
// false; The return type `value is StringOfLength<12, 12, string>`
isStringLength(firstNameBox, 12);
```


# isStringLengthBetween()

## `isStringLengthBetween()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) by using [`isString()`](/type-draft/is/isstring) of length within the specified range.

{% code title="is-string-length-between.func.ts" %}

```typescript
const isStringLengthBetween = <
  Type extends AnyString = string,
  Min extends number = number,
  Max extends number = number,
  Payload extends object = object
>(
  value: any,
  min: Min,
  max: Max,
  callback: ResultCallback<
    any,
    { min: Min; max: Max } & Payload
  > = resultCallback,
  payload?: Payload
): value is StringOfLength<Min, Max, Type> =>
  callback(
    isString(value)
      ? (isNumberType(min) && min >= 0
          ? value.valueOf().length >= min
          : false) &&
          (isNumberType(max) && max >= 0
            ? value.valueOf().length <= max
            : false)
      : false,
    value,
    { ...payload, min, max } as any
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-length-between.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>**`extends`**<mark style="color:green;">**`AnyString`**</mark>**`=`**<mark style="color:green;">**`string`**</mark>

A generic type variable `Type` constrained by [`AnyString`](/type-draft/type/anystring) indicates [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type of the given [`value`](#value-any) via the [return type](#return-type) and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

#### <mark style="color:green;">**`Min`**</mark>**`extends`**<mark style="color:green;">**`number`**</mark>

A generic type variable `Min` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type, by default of value captured from the supplied [`min`](#min-max) indicates the **minimum** length of the provided [`value`](#value-any) via the [return type](#return-type) and the fixed shape of optional [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

#### <mark style="color:green;">**`Max`**</mark>**`extends`**<mark style="color:green;">**`number`**</mark>

A generic type variable `Max` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type, by default of value captured from the supplied [`max`](#max-max) indicates the **maximum** length of the provided [`value`](#value-any) via the [return type](#return-type) and the fixed shape of optional [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback).&#x20;

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringLength()`](#isstringlength) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `min: Max`

The **minimum** length of generic type variable [`Min`](#minextendsnumber) for a given [`value`](#value-any).

#### `max: Max`

The **maximum** length of generic type variable [`Max`](#maxextendsnumber) for a given [`value`](#value-any).

#### `callback: ResultCallback<any, { min: Min, max: Max } & Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

{% hint style="info" %}
The [`payload`](/type-draft/type/resultcallback#payload-payload) parameter of the [`callback`](#callback-resultcallback-less-than-any-min-min-max-max-and-payload-greater-than) function consists of the [`min`](#min-max) and [`max`](#max-max) properties given in parameters of the core function, and they can't be overwritten by the given [`payload`](#payload-payload) parameter of the core function.
{% endhint %}

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is StringOfLength<Min, Max, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type [`StringOfLength`](/type-draft/type/stringoflength) that takes generic type variables [`Min`](#minextendsnumber) and [`Max`](#maxextendsnumber) as the **length** of the supplied [`value`](#value-any), and generic type variable [`Type`](#typeextendsanystring) as the type of the supplied [`value`](#value-any).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) of length within the specified range.

## Example usage

### `string` type

```typescript
// Example usage.
import { isStringLengthBetween } from '@angular-package/type';

const firstName = 'my first name';

// true; The return type `value is StringOfLength<0, 13, string>`
isStringLengthBetween(firstName, 0, 13);
// false; The return type `value is StringOfLength<0, 12, string>`
isStringLengthBetween(firstName, 0, 12);
v// false; The return type `value is StringOfLength<14, 28, string>`
isStringLengthBetween(firstName, 14, 28);
// true; The return type `value is StringOfLength<13, 13, string>`
isStringLengthBetween(firstName, 13, 13 ); 
```

### `String` instance

```typescript
// Example usage.
import { isStringLengthBetween } from '@angular-package/type';

const firstName = 'my first name';
const firstNameBox = new String(firstName);

// true; The return type `value is StringOfLength<0, 13, string>`
isStringLengthBetween(firstNameBox, 0, 13);
// false; The return type `value is StringOfLength<0, 12, string>`
isStringLengthBetween(firstNameBox, 0, 12);
// false; The return type `value is StringOfLength<14, 28, string>`
isStringLengthBetween(firstNameBox, 14, 28);
// true; The return type `value is StringOfLength<13, 13, string>`
isStringLengthBetween(firstNameBox, 13, 13);
```


# isStringObject()

## `isStringObject()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is of the type obtained from its [`object` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'string'` or an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) type, and an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

{% code title="is-string-object.func.ts" %}

```typescript
const isStringObject = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is String =>
  callback(
    (typeOf(value) === 'string' || typeof value === 'object') &&
    value instanceof String,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-object.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringObject()`](#isstringobject) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is String`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is [`String`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

## Example usage

```typescript
// Example usage.
import { isStringObject } from '@angular-package/type';

isStringObject('age'); // Returns `false` as `value is String`
isStringObject(new String('age')) // Returns `true` as `value is String`
```


# isStringType()

## `isStringType()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) value is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type.

{% code title="is-string-type.func.ts" %}

```typescript
const isStringType = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is string =>
  callback(typeof value === 'string', value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-string-type.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isStringType()`](#isstringtype) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is string`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type.

## Example usage

```typescript
// Example usage.
import { isStringType } from '@angular-package/type';

isStringType('age'); // Returns `true` as `value is string`
isStringType(new String('age')) // Returns `false` as `value is string`
```


# isSymbol()

## `isSymbol()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

{% code title="is-symbol.func.ts" %}

```typescript
const isSymbol = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is symbol =>
  callback(typeof value === 'symbol', value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-symbol.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isSymbol()`](#issymbol) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is symbol`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol).

## Example usage

```typescript
// Example usage.
import { isSymbol } from '@angular-package/type';

isSymbol(Symbol('age')); // Returns `true` as `value is symbol`
```


# ★ isTrue()

## `isTrue()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)(by using the [`isBoolean()`](/type-draft/is/isboolean)) equal to `true`.

{% code title="is-true.func.ts" %}

```typescript
const isTrue = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is true =>
  callback(isBoolean(value) ? value.valueOf() === true : false, value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-true.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isTrue()`](#istrue) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is true`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is `true`.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) that is equal to `true`.

## Example usage

```typescript
// Example usage.
import { isTrue } from '@angular-package/type';

isTrue(false); // Returns `false` as `value is true`
```


# isType()

## `isType()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is the type from a given [`type`](#type-types-less-than-t-greater-than) of the generic type [`Types`](/type-draft/type/types).

{% code title="is-type.func.ts" %}

```typescript
const isType = <T extends Type, Payload extends object = object>(
  value: any,
  type: Types<T>,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is T =>
  isStringType(type)
    ? {
        bigint: isBigInt,
        boolean: isBooleanType,
        function: isFunction,
        number: isNumberType,
        object: isObject,
        null: isNull,
        string: isStringType,
        symbol: isSymbol,
        undefined: isUndefined,
      }[type as Primitives](value, callback, payload)
    : isNotNull(type)
    ? isInstance(value, type, callback, payload)
    : false;
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-type.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`T`**</mark>**`extends`**<mark style="color:green;">**`Type`**</mark>

A generic type variable `T` constrained by the generic type [`Type`](/type-draft/type/type) indicates the type of [`value`](#value-any) parameter via the [return type](#return-type) `value is T` and captured type of the generic type [`Constructor`](/type-draft/type/constructor) of the supplied [`type`](#type-types-less-than-t-greater-than).

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isType()`](#istype) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check against the type of given [`type`](#type-types-less-than-t-greater-than).

#### `type: Types<T>`

A value of the generic type [`Types`](/type-draft/type/types) indicates against which type the provided [`value`](#value-any) is checked.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the `value` that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is T`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-any) is a generic type variable [`T`](#textendstype) by default equal to the [`Type`](/type-draft/type/type) but captured type [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) of the supplied [`type`](#type-types-less-than-t-greater-than) changes it to the class name.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is a type from a given [`type`](#type-types-less-than-t-greater-than) of the [`Types`](/type-draft/type/types).

## Example usage

```typescript
// Example usage.
import { isType } from '@angular-package/type';

class Person {}
const person = new Person();

// Primitives.
isType<bigint>(1n, 'bigint'); // Returns `true` as `value is bigint`
isType<boolean>(false, 'boolean'), // Returns `true` as `value is boolean`
isType<number>(27, 'number'); // Returns `true` as `value is number`
isType<null>(null, 'null'); // Returns `true` as `value is null`
isType<string>('age', 'string'); // Returns `true` as `value is string`
isType<symbol>(Symbol(27), 'symbol'); // Returns `true` as `value is symbol`
isType<undefined>(undefined, 'undefined'); // Returns `true` as `value is undefined`
// Function.
isType<Function>(() => {}, 'function'); // Returns `true` as `value is function`
// Object.
isType<object>({}, 'object'); // Returns `true` as `value is object`
// Class.
isType(person, Person); // Returns `true` as `value is Person`
// Class with callback and payload.
isType(person, Person, (result, value, payload) => {
  value // Person {}
  /*
  payload {
    value: {},
    id: 15,
    database: 'Persons'
  }
  */
  return result;
}, { id: 15, database: 'Persons' }); // Returns `true` as `value is Person`
```


# isUndefined()

## ​`isUndefined()`

Checks if [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) value is an [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined) type.

{% code title="is-undefined.func.ts" %}

```typescript
const isUndefined = <Payload extends object>(
  value: any,
  callback: ResultCallback<any, Payload> = resultCallback,
  payload?: Payload
): value is undefined => callback(typeof value === 'undefined', value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/lib/is-undefined.func.ts>" %}

### Generic type variables

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isUndefined()`](#isundefined) function from which it captures its value.

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type to check.

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is undefined`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-any) is [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined).

## Example usage

```typescript
// Example usage.
import { isUndefined } from '@angular-package/type';

let age;
isUndefined(age); // Returns `true` as `value is undefined`
isUndefined(27); // Returns `false` as `value is undefined`
```


# isNotBoolean()

## `isNotBoolean()`

Checks if the [`value`](#value-type) is not the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'boolean'`, not a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type and not an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

{% code title="is-not-boolean.func.ts" %}

```typescript
const isNotBoolean = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Never<AnyBoolean, Type> =>
  callback(
    typeOf(value) !== 'boolean' &&
      typeof value !== 'boolean' &&
      value instanceof Boolean === false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-boolean.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-array-less-than-type-greater-than) via the [return type](#return-type) `value is Never<AnyBoolean, Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotBoolean()`](#isnotboolean) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Return type

#### `value is Never<AnyBoolean, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Never`](/type-draft/type/never) that takes a generic type variable [`Type`](#type) by default of value captured from the supplied [`value`](#value-type) which changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never) on the captured type [`AnyBoolean`](/type-draft/type/anyboolean).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is **not** [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type and **not** an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

```typescript
// Example usage.
import { isNotBoolean } from '@angular-package/type';

const anyBoolean: any = true;
const strictBoolean = false;
const objectBoolean = new Boolean(strictBoolean);

isNotBoolean(anyBoolean); // false; return type is `value is any`
isNotBoolean(strictBoolean); // false; return type is `value is never`
isNotBoolean(objectBoolean); // false; return type is `value is never`
```


# isNotDefined()

## `isNotDefined()`

Checks if the [`value`](#value-type) is not the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'undefined'`, not an [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) type and is not equal to [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

{% code title="is-not-defined.func.ts" %}

```typescript
const isNotDefined = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Undefined<Type> =>
  callback(
    typeOf(value) === 'undefined' &&
      typeof value === 'undefined' &&
      value === undefined,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-defined.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Undefined<Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-array-less-than-type-greater-than-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotDefined()`](#isnotboolean) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Undefined<Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) that takes a generic type variable [`Type`](#type) by default of value captured from the supplied [`value`](#value-type) which changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never) on the captured type [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the [`value`](#value-type) is not defined, is [`undefined`](https://developer.mozilla.org/en-US/docs/Glossary/undefined).

## Example usage

```typescript
// Example usage.
import { isNotDefined } from '@angular-package/type';

const anyUndefined: any = undefined;
const firstName = undefined;
const surname = 'My last name ';

isNotDefined(anyUndefined); // true; return type is `value is any`
isNotDefined(firstName); // true;  return type is `value is undefined`
isNotDefined(surname); // false; return type is `value is never`
```


# isNotFunction()

## `isNotFunction()`

Checks if the [`value`](#value-type) is **not** the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'function'`, **not** a [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) type and **not** an instance of [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function).

{% code title="is-not-function.func.ts" %}

```typescript
const isNotFunction = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Never<Function, Type> =>
  callback(
    typeOf(value) !== 'function' &&
      typeof value !== 'function' &&
      value instanceof Function === false,
    value,
    payload
  );

```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-function.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Never<Function, Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-array-less-than-type-greater-than-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotFunction()`](#isnotfunction) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Never<Function, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Never`](/type-draft/type/never) that takes a generic type variable [`Type`](#type) by default of value captured from the supplied [`value`](#value-type), but on the captured type [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is not a [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function).

## Example usage

```typescript
// Example usage.
import { IsNotFunction } from '@angular-package/type';

const anyFunc: any = (x: number) => x + 5;
const myFunc = (x: string) => x;

isNotFunction(anyFunc); // false; return type is `value is any`
isNotFunction(myFunc); // false; return type is `value is never`
isNotFunction('maybe i am not a function'); // true; return type is `value is string`
```


# isNotNull()

## `isNotNull()`

Checks if the [`value`](#value-type) is **not** the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'null'` and **not** equal to [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

{% code title="is-not-null.func.ts" %}

```typescript
const isNotNull = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Never<null, Type> =>
  callback(typeOf(value) !== 'null' && value !== null, value, payload);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-null.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Never<null, Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-array-less-than-type-greater-than-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotNull()`](#isnotfunction) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Never<null, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Never`](/type-draft/type/never) that takes a generic type variable [`Type`](#type) by default of value captured from the supplied [`value`](#value-type), but on the captured [`null`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is not [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).&#x20;

## Example usage

```typescript
// Example usage.
import { isNotNull } from '@angular-package/type';

const anyNull: any = null;
const firstName = null;

isNotNull(anyNull); // return type is `value is any`
isNotNull(firstName); // return type is `value is never`
```


# isNotNumber()

## `isNotNumber()`

Checks if the [`value`](#value-type) is **not** the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'number'`, not a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type and not an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

{% code title="is-not-number.func.ts" %}

```typescript
const isNotNumber = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Never<AnyNumber, Type> =>
  callback(
    typeOf(value) !== 'number' &&
      typeof value !== 'number' &&
      value instanceof Number === false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-number.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Never<AnyNumber, Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotNumber()`](#isnotnull) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-any) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Never<AnyNumber, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Never`](/type-draft/type/never) that takes a generic type variable [`Type`](#type) from the supplied [`value`](#value-type) and **not** equal to [`AnyNumber`](/type-draft/type/anynumber), which makes it [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never) [`AnyNumber`](/type-draft/type/anynumber) but of type captured from the supplied [`value`](#value-type).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is not a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type and not an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

## Example usage

```typescript
// Example usage.
import { isNotNumber } from '@angular-package/type';

const anyNumber: any = 'any number';
const firstName = 'firstName';
const age = 27;
const objectNumber = new Number(927);

isNotNumber(anyNumber); // return type is `value is any`
isNotNumber(firstName); // return type is `value is string`
isNotNumber(age); // return type is `value is never`
isNotNumber(objectNumber); // return type is `value is never`// Example usage.
import { isNotNull } from '@angular-package/type';

const anyNull: any = null;
const firstName = null;

isNotNull(anyNull); // return type is `value is any`
isNotNull(firstName); // return type is `value is never`
```


# isNotString()

## `isNotString()`

Checks if the [`value`](#value-type) is **not** the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'string'`, **not** a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type and **not** an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

{% code title="is-not-string.func.ts" %}

```typescript
const isNotString = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Never<AnyString, Type> =>
  callback(
    typeOf(value) !== 'string' &&
      typeof value !== 'string' &&
      value instanceof String === false,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-string.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Never<AnyString, Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotString()`](#isnotstring) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Never<AnyString, Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Never`](/type-draft/type/never) that takes a generic type variable [`Type`](#type) from the supplied [`value`](#value-type) and **not** equal to [`AnyString`](/type-draft/type/anystring), which makes it [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never) [`AnyString`](/type-draft/type/anystring) but of type captured from the supplied [`value`](#value-type).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is not a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) and not an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

## Example usage

```typescript
// Example usage.
import { isNotString } from '@angular-package/type';

const anyString: any = 'any string';
const firstName = 'firstName';
const age = 27;
const objectString = new String('hold me');

isNotString(anyString); // return type is `value is any`
isNotString(firstName); // return type is `value is never`
isNotString(age); // return type is `value is number`
isNotString(objectString); // return type is `value is never`
```


# isNotUndefined()

## `isNotUndefined()`

Checks if the [`value`](#value-type) is **not** the type obtained from its [object class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#using_tostring_to_detect_object_class) equal to `'undefined'`, **not** an [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) type and **not** equal to [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

{% code title="is-not-undefined.func.ts" %}

```typescript
const isNotUndefined = <Type, Payload extends object = object>(
  value: Type,
  callback: ResultCallback<Type, Payload> = resultCallback,
  payload?: Payload
): value is Defined<Type> =>
  callback(
    typeOf(value) !== 'undefined' &&
      typeof value !== 'undefined' &&
      value !== undefined,
    value,
    payload
  );
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/is/not/lib/is-not-undefined.func.ts>" %}

### Generic type variables

#### <mark style="color:green;">**`Type`**</mark>

A generic type variable `Type` indicates the captured type of the given [`value`](#value-type) via the [return type](#return-type) `value is Defined<Type>` and the [`value`](/type-draft/type/resultcallback#value-value) parameter of the provided [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function [`ResultCallback`](/type-draft/type/resultcallback) type.

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

The `Payload` generic type variable constrained by [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`isNotUndefined()`](#isnotundefined) function from which it captures its value.

### Parameters

#### `value: Type`

The `value` of generic type variable [`Type`](#type), by default of the type captured from itself to check.

#### `callback: ResultCallback<Type, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the [`value`](#value-type) that has been checked, the [`result`](/type-draft/type/resultcallback#result-boolean) of this check, and [`payload`](/type-draft/type/resultcallback#payload-payload) of generic type variable [`Payload`](#payloadextendsobject-object) with optional properties from the provided [`payload`](#payload-payload), to handle them before the [`result`](/type-draft/type/resultcallback#result-boolean) return. By default, it uses [`resultCallback()`](/type-draft/helper/resultcallback) function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendsobject-object) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-type-payload-greater-than) function.

### Return type

#### `value is Defined<Type>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) as the result of its statement indicating the [`value`](#value-type) is a generic type [`Defined`](/type-draft/type/defined) that takes a generic type variable [`Type`](#type) of value by default equal to the type captured from the supplied [`value`](#value-type) parameter excepts [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) which changes to [`never`](https://www.typescriptlang.org/docs/handbook/basic-types.html#never).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`value`](#value-type) is **not** [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

## Example usage

```typescript
// Example usage.
import { is } from '@angular-package/type';

interface Config {
  a?: string;
  b?: string;
}
const config: Config = {
  a: 'x',
  b: 'y'
};

function configFunction(value: string): string {
  return '';
}

if (is.not.undefined(config.a)) {
  configFunction(config.a);
}
```


# areDeterminer()

## `areDeterminer()`

The function returns the object of [`every()`](/type-draft/are/aredeterminer/every), [`forEach()`](/type-draft/are/aredeterminer/foreach) and [`some()`](/type-draft/are/aredeterminer/some) 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 %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-determiner.func.ts>" %}

### 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()`](/type-draft/are/aredeterminer/every), [`some()`](/type-draft/are/aredeterminer/some) and [`forEach()`](/type-draft/are/aredeterminer/foreach) as methods of checking supplied [`values`](#...values-any).


# every()

## `areDeterminer().every()`

Checks whether **every** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredeterminer/pages/9tQVF4vAlNggvR668PDn#...values-any) pass the test implemented by the given [`checkFn`](/type-draft/are/aredeterminer#checkfn-function) function.

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

```typescript
{
  every: <Payload extends CommonPayload>(
    callback: ResultCallback<any, Payload> = resultCallback,
    payload?: Payload
  ): boolean =>
    callback(
      values.every((value) => checkFn(value)),
      values,
      payload
    ),
}
```

{% endcode %}

### Generic type variables

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

The `Payload` generic type variable constrained by the generic type variable [`CommonPayload`](/type-draft/are/aredeterminer#commonpayloadextendsobject) indicates the type of optional parameter [`payload`](/type-draft/type/resultcallback#payload-payload) of the supplied [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function and [`payload`](#payload-payload) optional parameter of the [`areDeterminer().every()`](#aredeterminer-.every) method from which it captures its value.

### Parameters

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the `value` that has been checked, the `result` of this check, and `payload` of generic type variable `Payload` with optional properties from the provided `payload`, to handle them before the `result` return. By default, it uses `resultCallback()` function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendscommonpayload) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/aredeterminer/pages/9tQVF4vAlNggvR668PDn#...values-any) passed the test implemented by the given [`checkFn`](/type-draft/are/aredeterminer#checkfn-function) function.

## Example usage

```typescript
// Example usage.
import { areDeterminer } from '@angular-package/type';


```


# forEach()

## `areDeterminer().forEach()`

The `forEach()` method executes a provided [`callback`](#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/aredeterminer/pages/9tQVF4vAlNggvR668PDn#...values-any).

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

```typescript
{
  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)
      );
  },
}
```

{% endcode %}

### Generic type variables

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

The `Payload` generic type variable constrained by generic type variable [`CommonPayload`](/type-draft/are/aredeterminer#commonpayloadextendsobject) indicates the type of the [`payload`](#payload-payload) parameter from which it gets its value.

### Parameters

#### `forEachCallback: ForEachCallback<any, Payload>`

A callback `function` of [`ForEachCallback`](/type-draft/type/foreachcallback) type with parameters, the `value` that has been checked, the `result` of this check, `index` of each element, the provided `values` and `payload` of generic type variable `Payload` with optional properties from the provided `payload`, to handle.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendscommonpayload) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

## Example usage

```typescript
// Example usage.
import { areDeterminer } from '@angular-package/type';


```


# some()

## `areDeterminer().some()`

Checks if some of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredeterminer/pages/9tQVF4vAlNggvR668PDn#...values-any) pass the test implemented by the given [`checkFn`](/type-draft/are/aredeterminer#checkfn-function).

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

```typescript
{
  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;">**`Payload`**</mark>**`extends`**<mark style="color:green;">**`CommonPayload`**</mark>

The `Payload` generic type variable constrained by generic type variable [`CommonPayload`](/type-draft/are/aredeterminer#commonpayloadextendsobject) indicates the type of the [`payload`](#payload-payload) parameter from which it gets its value.

### Parameters

#### `callback: ResultCallback<any, Payload>`

A callback `function` of [`ResultCallback`](/type-draft/type/resultcallback) type with parameters, the `value` that has been checked, the `result` of this check, and `payload` of generic type variable `Payload` with optional properties from the provided `payload`, to handle them before the `result` return. By default, it uses `resultCallback()` function.

#### `payload?: Payload`

An optional [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of the generic type variable [`Payload`](#payloadextendscommonpayload) is assigned to the [`payload`](/type-draft/type/resultcallback#payload-payload) of the given [`callback`](#callback-resultcallback-less-than-any-payload-greater-than) function.

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredeterminer/pages/9tQVF4vAlNggvR668PDn#...values-any) passed the test of the given [`checkFn`](/type-draft/are/aredeterminer#checkfn-function).

## Example usage

```typescript
// Example usage.
import { areDeterminer } from '@angular-package/type';

```


# areBigInt()

## `areBigInt()`

Checks whether the values are a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type by using [`every()`](/type-draft/are/arebigint/every), [`forEach()`](/type-draft/are/arebigint/foreach) and [`some()`](/type-draft/are/arebigint/some) methods of the returned object.

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

```typescript
const areBigInt = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isBigInt, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-bigint.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of [`every()`](/type-draft/are/arebigint/every), [`some()`](/type-draft/are/arebigint/some) and [`forEach()`](/type-draft/are/arebigint/foreach) as methods of checking supplied [`values`](#...values-any).


# every()

## `areBigInt().every()`

Checks whether **every** provided [`value`](https://type.angular-package.dev/type-draft/are/arebigint/pages/Q5zKAPSIgBHO1MVJGW8n#...values-any) of [`areBigInt()`](/type-draft/are/arebigint) is a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/arebigint/pages/9tQVF4vAlNggvR668PDn#...values-any) of [`areBigInt()`](/type-draft/are/arebigint) are a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

## Example usage

```typescript
// Example usage.
import { areBigInt } from '@angular-package/type';

areBigInt(1n, 22n).every((result, value, payload) => {
  result // true
  value /// [1n, 22n]
  payload // undefined
  return result;
}); // true, boolean
```


# forEach()

## `areBigInt().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/arebigint/pages/Q5zKAPSIgBHO1MVJGW8n#...values-any) of [`areBigInt()`](/type-draft/are/arebigint).&#x20;

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areBigInt } from '@angular-package/type';

areBigInt(1n, 2, '3').forEach(
  (result, value, index, array, payload) => {
    result // true, false, false
    value // 1n, 2, 3
    index // 0, 1, 2
    array // [ 1n, 2, 3 ]
    payload // undefined
    return result;
  },
  { age: 2 }
);
```


# some()

## `areBigInt().some()`

Checks whether **some** provided [`values`](https://type.angular-package.dev/type-draft/are/arebigint/pages/Q5zKAPSIgBHO1MVJGW8n#...values-any) of [`areBigInt()`](/type-draft/are/arebigint) are a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arebigint/pages/Q5zKAPSIgBHO1MVJGW8n#...values-any) of [`areBigInt()`](/type-draft/are/arebigint) are a [`bigint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) type.

## Example usage

```typescript
// Example usage.
import { areBigInt } from '@angular-package/type';

areBigInt(1n, 2, '3').some((result, value, payload) => {
  result // true
  value // [1n, 2, '3']
  payload // undefined
  return result;
});
```


# areBoolean()

## `areBoolean()`

Checks whether the **values** are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areBoolean = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isBoolean, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-boolean.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) type or an instance of [`Boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areBoolean().every()`

Checks whether **every** of the provided [`values`](https://type.angular-package.dev/type-draft/are/areboolean/pages/jVLq1ylc8yYVnwV9EUVj#...values-any) of [`areBoolean()`](/type-draft/are/areboolean) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/areboolean/pages/jVLq1ylc8yYVnwV9EUVj#...values-any) of [`areBoolean()`](/type-draft/are/areboolean) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

```typescript
// Example usage.
import { areBoolean } from '@angular-package/type';

areBoolean(1, true, null, new Boolean(3)).every((result, value, payload) => {
  result // false
  value // [1, true, null, Boolean]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areBoolean().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/areboolean/pages/jVLq1ylc8yYVnwV9EUVj#...values-any) of [`areBoolean()`](/type-draft/are/areboolean).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areBoolean } from '@angular-package/type';

areBoolean(1, true, null, new Boolean(3)).forEach(
  (result, value, index, array, payload) => {
    result // false, true, false, true
    value // 1, true, null, Boolean
    index // 0, 1, 2, 3
    array // [ 1, true, null, Boolean ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areBoolean().some()`

Checks whether some of the provided [`values`](https://type.angular-package.dev/type-draft/are/areboolean/pages/jVLq1ylc8yYVnwV9EUVj#...values-any) of [`areBoolean()`](/type-draft/are/areboolean) are a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) type or an instance of [`Boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/areboolean/pages/jVLq1ylc8yYVnwV9EUVj#...values-any) of [`areBoolean()`](/type-draft/are/areboolean) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean).

## Example usage

```typescript
// Example usage.
import { areBoolean } from '@angular-package/type';

areBoolean(1, true, null, new Boolean(3)).some((result, value, payload) => {
  result // true
  value // [1, true, null, Boolean]
  payload // undefined
  return result;
}); // true, boolean
```


# areDate()

## `areDate()`

Checks whether the values are [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areDate = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isDate, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-date.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areDate().every()`

Checks whether **every** provided [`value`](https://type.angular-package.dev/type-draft/are/aredate/pages/EHobj4KgMnkW3V1Tcvbi#...values-any) of [`areDate()`](/type-draft/are/aredate) is a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/aredate/pages/EHobj4KgMnkW3V1Tcvbi#...values-any) of [`areDate()`](/type-draft/are/aredate) are [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

## Example usage

```typescript
// Example usage.
import { areDate } from '@angular-package/type';

areDate(new Date(), new Date('invalid date')).every((result, value, payload) => {
  result // false
  value // [Sat Sep 11 2021 21:36:43 GMT+0200 (Central European Summer Time), Invalid Date]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areDate().forEach()`

The `forEach()` method executes a provided callback function once for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/aredate/pages/EHobj4KgMnkW3V1Tcvbi#...values-any) of [`areDate()`](/type-draft/are/aredate).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areDate } from '@angular-package/type';

areDate(new Date(), new Date('invalid date')).forEach(
  (result, value, index, array, payload) => {
    result // true, false
    value // Sat Sep 11 2021 21:38:19 GMT+0200 (Central European Summer Time, Invalid Date
    index // 0, 1
    array // [ Sat Sep 11 2021 21:38:19 GMT+0200 (Central European Summer Time), Invalid Date ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areDate().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredate/pages/EHobj4KgMnkW3V1Tcvbi#...values-any) of [`areDate()`](/type-draft/are/aredate) are [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredate/pages/EHobj4KgMnkW3V1Tcvbi#...values-any) of [`areDate()`](/type-draft/are/aredate) are [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).

## Example usage

```typescript
// Example usage.
import { areDate } from '@angular-package/type';

areDate(new Date(), new Date('invalid date')).some((result, value, payload) => {
  result // true
  value // [Sat Sep 11 2021 21:37:43 GMT+0200 (Central European Summer Time), Invalid Date]
  payload // undefined
  return result;
}); // true, boolean
```


# areDefined()

## `areDefined()`

Checks whether the **values** are **defined** by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areDate = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isDate, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-defined.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check whether its elements are defined.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of [`every()`](https://app.gitbook.com/s/HmRqpb9wXbHlBaTRCXZm/c/zkFcxLE4HTwIcknJCu1A/are/areboolean/every), [`some()`](https://app.gitbook.com/s/HmRqpb9wXbHlBaTRCXZm/c/zkFcxLE4HTwIcknJCu1A/are/areboolean/some) and [`forEach()`](https://app.gitbook.com/s/HmRqpb9wXbHlBaTRCXZm/c/zkFcxLE4HTwIcknJCu1A/are/areboolean/foreach) as methods of checking supplied [`values`](#...values-any).


# every()

## `areDefined().every()`

Checks whether **every** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredefined/pages/VSFc2q8S8XqiAax5rOFQ#...values-any) of [`areDefined()`](/type-draft/are/aredefined) is **defined**.

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/aredefined/pages/VSFc2q8S8XqiAax5rOFQ#...values-any) of [`areDefined()`](/type-draft/are/aredefined) are **defined**.

## Example usage

```typescript
// Example usage.
import { areDefined } from '@angular-package/type';

let age;

areDefined('1', 2, null, undefined, age).every((result, value, payload) => {
  result // false
  value // [ '1', 2, null, undefined, undefined ]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areDefined().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/aredefined/pages/VSFc2q8S8XqiAax5rOFQ#...values-any) of [`areDefined()`](/type-draft/are/aredefined).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areDefined } from '@angular-package/type';

let age;

areDefined('1', 2, null, undefined, age).forEach(
  (result, value, index, array, payload) => {
    result // true, true, true, false, false
    value // '1', 2, null, undefined, undefined
    index // 0, 1, 2, 3, 4
    array // [ '1', 2, null, undefined, undefined ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areDefined().some()`

Checks whether some of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredefined/pages/VSFc2q8S8XqiAax5rOFQ#...values-any) of [`areDefined()`](/type-draft/are/aredefined) are defined.

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aredefined/pages/VSFc2q8S8XqiAax5rOFQ#...values-any) of [`areDefined()`](/type-draft/are/aredefined) are **defined**.

## Example usage

```typescript
// Example usage.
import { areDefined } from '@angular-package/type';

let age;

areDefined('1', 2, null, undefined, age).some((result, value, payload) => {
  result // true
  value // [ '1', 2, null, undefined, undefined ]
  payload // undefined
  return result;
}); // true, boolea

```


# ★ areFalse()

## `areFalse()`

Checks whether the **values** are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `false` by using `every()`, `forEach()` and `some()`methods of the returned object.

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

```typescript
const areFalse = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isFalse, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-false.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `false`.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areFalse().every()`

Checks whether **every** provided value of rest parameter [`values`](https://type.angular-package.dev/type-draft/are/arefalse/pages/c3qyq9FppmyHV58VeTFx#...values-any) of the [`areFalse()`](/type-draft/are/arefalse) function is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to false.

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided values of [`areFalse()`](/type-draft/are/arefalse) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `false`.

## Example usage

```typescript
// Example usage.
import { areFalse } from '@angular-package/type';

areFalse(true, null, false, new Boolean(false)).every((result, value, payload) => {
  result // false
  value // [ true, null, false, Boolean ]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areFalse().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/arefalse/pages/c3qyq9FppmyHV58VeTFx#...values-any) of [`areFalse()`](/type-draft/are/arefalse).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areFalse } from '@angular-package/type';

areFalse(true, null, false, new Boolean(false)).forEach(
  (result, value, index, array, payload) => {
    result // false, false, true, true
    value // true, null, false, Boolean
    index // 0, 1, 2, 3
    array // [ true, null, false, Boolean ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areFalse().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arefalse/pages/c3qyq9FppmyHV58VeTFx#...values-any) of [`areFalse()`](/type-draft/are/arefalse) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `false`.

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether some of the provided [`values`](https://type.angular-package.dev/type-draft/are/arefalse/pages/c3qyq9FppmyHV58VeTFx#...values-any) of [`areFalse()`](/type-draft/are/arefalse) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `false`.

## Example usage

```typescript
// Example usage.
import { areFalse } from '@angular-package/type';

areFalse(true, null, false, new Boolean(false)).some((result, value, payload) => {
  result // true
  value // [ true, null, false, Boolean ]
  payload // undefined
  return result;
}); // true, boolean
```


# areNull()

## `areFalse()`

Checks whether the values are [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areNull = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isNull, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-null.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areNull().every()`

Checks whether **every** provided value of [`areNull()`](/type-draft/are/arenull) is [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/arenull/pages/QVoHF92l5g9kLDSaJMcu#...values-any) of [`areNull()`](/type-draft/are/arenull) are [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

## Example usage

```typescript
// Example usage.
import { areNull } from '@angular-package/type';

areNull(null, undefined, false, !!null).every((result, value, payload) => {
  result // false
  value // [ null, undefined, false, false ]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areNull().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/arenull/pages/QVoHF92l5g9kLDSaJMcu#...values-any) of [`areNull()`](/type-draft/are/arenull).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areNull } from '@angular-package/type';

areNull(true, null, false, new Boolean(false)).forEach(
  (result, value, index, array, payload) => {
    result // false, true, false, false
    value // null, undefined, false, false
    index // 0, 1, 2, 3
    array // [ null, undefined, false, false ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areNull().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arenull/pages/QVoHF92l5g9kLDSaJMcu#...values-any) of [`areNull()`](/type-draft/are/arenull) are [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether some of the provided [`values`](https://type.angular-package.dev/type-draft/are/arenull/pages/QVoHF92l5g9kLDSaJMcu#...values-any) of [`areNull()`](/type-draft/are/arenull) are [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null).

## Example usage

```typescript
// Example usage.
import { areNull } from '@angular-package/type';

areNull(true, null, false, new Boolean(false)).some((result, value, payload) => {
  result // true
  value // [ null, undefined, false, false ]
  payload // undefined
  return result;
}); // true, boolean
```


# ★ areNumber()

## `areFalse()`

Checks whether the values are [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areNumber = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isNumber, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-number.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areNumber().every()`

Checks whether every of the provided  of [`areNumber()`](/type-draft/are/arenumber) is a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided values of [`areNumber()`](/type-draft/are/arenumber) are a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

## Example usage

```typescript
// Example usage.
import { areNumber } from '@angular-package/type';

areNumber(1, new Number(2), Number(3), '4').every((result, value, payload) => {
  result // false
  value // [ 1, Number, 3, '4' ]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areNumber().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/arenumber/pages/YJFyroOoNJiMTEUsCpzH#...values-any) of [`areNumber()`](/type-draft/are/arenumber).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areNumber } from '@angular-package/type';

areNumber(1, new Number(2), Number(3), '4').forEach(
  (result, value, index, array, payload) => {
    result // true, true, true, false
    value // 1, Number, 3, '4'
    index // 0, 1, 2, 3
    array // [ 1, Number, 3, '4' ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areNumber().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arenumber/pages/YJFyroOoNJiMTEUsCpzH#...values-any) of [`areNumber()`](/type-draft/are/arenumber) are a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arenumber/pages/YJFyroOoNJiMTEUsCpzH#...values-any) of [`areNumber()`](/type-draft/are/arenumber) are a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type or an instance of [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

## Example usage

```typescript
// Example usage.
import { areNumber } from '@angular-package/type';

areNumber(1, new Number(2), Number(3), '4').some((result, value, payload) => {
  result // true
  value // [ 1, Number, 3, '4' ]
  payload // undefined
  return result;
}); // true, boolean
```


# areRegExp()

## `areRegExp()`

Checks whether the values are regular expressions of [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areRegExp = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isRegExp, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-regexp.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against the regular expression of [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areRegExp().every()`

Checks whether every of the provided [`values`](https://type.angular-package.dev/type-draft/are/areregexp/pages/YUnYULRZXKUhOrYtCrmh#...values-any) of [`areRegExp()`](/type-draft/are/areregexp) is a regular expression of [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided values of [`areRegExp()`](/type-draft/are/areregexp) are regular expressions of a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

### Example usage

```typescript
// Example usage.
import { areRegExp } from '@angular-package/type';

areRegExp(/^[]/, /^[]/, /^[]/, 3).every((result, value, payload) => {
  result // false
  value // [/^[]/, /^[]/, /^[]/, 3]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areRegExp().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/areregexp/pages/YUnYULRZXKUhOrYtCrmh#...values-any) of [`areRegExp()`](/type-draft/are/areregexp).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areRegExp } from '@angular-package/type';

areRegExp(/^[]/, /^[]/, /^[]/, 3).forEach(
  (result, value, index, payload, array) => {
    result // true, true, true, false
    value // /^[]/, /^[]/, /^[]/, 4
    index // 0, 1, 2, 3
    array // [ /^[]/, /^[]/, /^[]/, 3 ]
    payload // { age: 2 }
    if (result === true) {
      // Do something.
    }
    return result;
  },
  { age: 2 }
);
```


# some()

## `areRegExp().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/areregexp/pages/YUnYULRZXKUhOrYtCrmh#...values-any) of [`areRegExp()`](/type-draft/are/areregexp) are regular expressions of [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether some of the provided `values` of [`areRegExp()`](/type-draft/are/areregexp) are [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) type.

## Example usage

```typescript
// Example usage.
import { areRegExp } from '@angular-package/type';

areRegExp(/^[]/, /^[]/, /^[]/, 3).some((result, value, payload) => {
  result // true
  value // [/^[]/, /^[]/, /^[]/, 3]
  payload // undefined
  return result;
});
```


# ★ areString()

## `areString()`

Checks whether the values are a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areString = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isString, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-string.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areString().every()`

Checks whether **every** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arestring/pages/b0vQyPwXOJUzA90kqkAX#...values-any) of [`areString()`](/type-draft/are/arestring) is a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided values of [`areString()`](/type-draft/are/arestring) are a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

## Example usage

```typescript
// Example usage.
import { areString } from '@angular-package/type';

areString(1, '2', '3').every((result, value, payload) => {
  result // true
  value // [1, '2', '3']
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areString().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/arestring/pages/b0vQyPwXOJUzA90kqkAX#...values-any) of [`areString()`](/type-draft/are/arestring).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areString } from '@angular-package/type';

areString(1, '2', '3', false).forEach(
  (result, value, index, array, payload) => {
    result // false, true, true, false
    value // 1, '2', '3', false
    index // 0, 1, 2, 3
    array // [ 1, '2', '3', false ]
    payload // { age: 2 }
  },
  { age: 2 }
);
```


# some()

## `areString().some()`

Checks whether some of the provided [`values`](https://type.angular-package.dev/type-draft/are/arestring/pages/b0vQyPwXOJUzA90kqkAX#...values-any) of [`areString()`](/type-draft/are/arestring) are a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/arestring/pages/b0vQyPwXOJUzA90kqkAX#...values-any) of [`areString()`](/type-draft/are/arestring) are a [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) type or an instance of [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).

## Example usage

```typescript
// Example usage.
import { areString } from '@angular-package/type';

areString(1, '2', '3').some((result, value, payload) => {
  result // true
  value // [1, '2', '3']
  payload // undefined
  return result;
}); // true, boolean
```


# areSymbol()

## `areSymbol()`

Checks whether the values are a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areSymbol = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isSymbol, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-symbol.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](#...values-any).


# every()

## `areSymbol().every()`

Checks if every of the provided [`values`](https://type.angular-package.dev/type-draft/are/aresymbol/pages/UDfjV4Bkr2iPa9qgNBfk#...values-any) of [`areSymbol()`](/type-draft/are/aresymbol) is a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided values of [`areSymbol()`](/type-draft/are/aresymbol) are a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

## Example usage

```typescript
// Example usage.
import { areSymbol } from '@angular-package/type';

areSymbol(Symbol(1), 2, Symbol(3), 4).every((result, value, payload) => {
  result // true
  value // [ Symbol(1), 2, Symbol(3), 4 ]
  payload // undefined
  return result;
}); // false, boolean
```


# forEach()

## `areSymbol().forEach()`

The `forEach()` method executes a provided [`callback`](/type-draft/are/aredeterminer/foreach#foreachcallback-foreachcallback-less-than-any-payload-greater-than) function **once** for each element of the supplied [`values`](https://type.angular-package.dev/type-draft/are/aresymbol/pages/UDfjV4Bkr2iPa9qgNBfk#...values-any) of [`areSymbol()`](/type-draft/are/aresymbol).

{% hint style="info" %}
The method uses [`forEach()`](/type-draft/are/aredeterminer/foreach) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

## Example usage

```typescript
// Example usage.
import { areSymbol } from '@angular-package/type';

areSymbol(Symbol(1), 2, Symbol(3), 4).forEach(
  (result, value, index, array, payload) => {
    result // true, false, true, false
    value // Symbol(1), 2, Symbol(3), 4
    index // 0, 1, 2, 3
    array // [ Symbol(1), 2, Symbol(3), 4 ]
    payload //  { age: 2 }

    if (result === true) {
      // if undefined do something.
    }
  },
  { age: 2 }
); // void
```


# some()

## `areSymbol().some()`

Checks whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aresymbol/pages/UDfjV4Bkr2iPa9qgNBfk#...values-any) of [`areSymbol()`](/type-draft/are/aresymbol) are a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

{% hint style="info" %}
The method uses [`some()`](/type-draft/are/aredeterminer/some) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether **some** of the provided [`values`](https://type.angular-package.dev/type-draft/are/aresymbol/pages/UDfjV4Bkr2iPa9qgNBfk#...values-any) of [`areSymbol()`](/type-draft/are/aresymbol) are a [`symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) type.

## Example usage

```typescript
// Example usage.
import { areSymbol } from '@angular-package/type';

areSymbol(Symbol(1), 2, Symbol(3), 4).some((result, value, payload) => {
  result // true
  value // [ Symbol(1), 2, Symbol(3), 4 ]
  payload // undefined
  return result;
}); // true, boolean
```


# ★ areTrue()

## `areTrue()`

Checks whether the values are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `true` by using `every()`, `forEach()` and `some()` methods of the returned object.

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

```typescript
const areTrue = <CommonPayload extends object>(...values: any[]) =>
  areDeterminer<CommonPayload>(isTrue, ...values);
```

{% endcode %}

{% embed url="<https://github.com/angular-package/type/blob/main/src/are/lib/are-true.func.ts>" %}

### 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

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

A rest parameter of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check its elements against a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `true`.

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of `every()`, `some()` and `forEach()` as methods of checking supplied [`values`](https://type.angular-package.dev/type-draft/are/pages/DHh96H0NsUt18IPbtlCD#...values-any).


# every()

## `areTrue().every()`

Checks whether every of the provided [`values`](https://type.angular-package.dev/type-draft/are/aretrue/pages/DHh96H0NsUt18IPbtlCD#...values-any) of [`areTrue()`](/type-draft/are/aretrue) is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `true`.

{% hint style="info" %}
The method uses [`every()`](/type-draft/are/aredeterminer/every) method of [`areDeterminer()`](/type-draft/are/aredeterminer).
{% endhint %}

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the provided [`values`](https://type.angular-package.dev/type-draft/are/aretrue/pages/DHh96H0NsUt18IPbtlCD#...values-any) of [`areTrue()`](/type-draft/are/aretrue) are a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type or an instance of [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) equal to `true`.

## Example usage

```typescript
// Example usage.
import { areTrue } from '@angular-package/type';

const deleteElements = [true, false, false,  new Boolean(false)];

areTrue(...deleteElements).every((result, value, payload) => {
  result // false
  value // [ true, false, false, Boolean ]
  payload // undefined
  return result;
}); // false, boolean
```




---

[Next Page](/llms-full.txt/1)

