# static isWrap()

## `Wrap.isWrap()`

The method checks whether the [`value`](#value-any) of any type is the [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) instance of any or given [`opening`](#opening-opening) and [`closing`](#closing-closing) chars.

{% code title="wrap.class.ts" %}

```typescript
public static isWrap<
  Opening extends string = string,
  Closing extends string = string,
  Text extends string = ``
>(
  value: any,
  opening?: Opening,
  closing?: Closing,
  text?: Text
): value is Wrap<Opening, Text, Closing> {
  return typeof value === 'object' && value instanceof this
    ? (typeof opening === 'string' ? opening === value.opening : true) &&
        (typeof closing === 'string' ? closing === value.closing : true) &&
        (typeof text === 'string' ? text === value.text : true)
    : false;
}
```

{% endcode %}

### Generic type variables

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

A generic type variable constrained by the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string), by default of the value captured from the provided [`opening`](#opening-opening) indicates the `Opening` type of the [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) instance the [return type](#return-type).

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

A generic type variable constrained by the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string), by default of the value captured from the provided [`closing`](#closing-closing) indicates the `Closing` type of the [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) instance via [return type](#return-type).

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

A generic type variable constrained by the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string), by default of the value captured from the provided [`text`](#text-text) indicates the `Text` type of the [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) instance via [return type](#return-type).

### Parameters

#### `value: any`

The value of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to test against the [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) instance of any or given [`opening`](#opening-opening) and [`closing`](#closing-closing).

#### `opening?: Opening`

Optional opening chars of a generic type variable [`Opening`](#openingextendsstring-string) to check if the given [`value`](#value-any) contains.

#### `closing?: Closing`

Optional closing chars of a generic type variable [`Closing`](#closingextendsstring-string) to check if the given [`value`](#value-any) contains.

#### `text?: Text`

An optional text of a generic type variable [`Text`](#textextendsstring) to check if the given [`value`](#value-any) contains.

### Return type

**`value is Wrap<Opening, Text, Closing>`**

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) indicating the [`value`](#value-any) parameter is an instance of [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) that takes a generic type variable [`Opening`](#openingextendsstring-string) [`Text`](#textextendsstring) and [`Closing`](#closingextendsstring-string).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type indicating whether the [`value`](#value-any) is an instance of [`Wrap`](https://wrapper.angular-package.dev/wrapper-draft/wrap) of any, or the given [`opening`](#opening-opening), [`closing`](#closing-closing), and [`text`](#text-text).

## Example usage

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

const tagWrap = new Wrap(`[`, `]`, 'quote');

// Returns true confirming the type Wrap<"[", "", "]">
Wrap.isWrap(tagWrap);

// Returns true, confirming the type Wrap<"[", "", "]">
Wrap.isWrap(tagWrap, '[', ']');

// Returns true, confirming the type Wrap<"[", "quote", "]">
Wrap.isWrap(tagWrap, '[', ']', 'quote');

// Returns true, confirming the type Wrap<"[", "", "]">
Wrap.isWrap<'[', ']'>(tagWrap, '[', ']');

// Returns false, denying the type Wrap<"[", "span", "]">
Wrap.isWrap(tagWrap, '[', ']', 'span');

// Returns false denying the value is Wrap<"(", "", ")">
Wrap.isWrap(tagWrap, '(', ')');

// Returns false denying the value is Wrap<"(", "", ")">
Wrap.isWrap<'[', ']'>(null as any);

// Returns false denying the value is Wrap<"[", "", "]">
Wrap.isWrap(null as any, '[', ']');
```


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://wrapper.angular-package.dev/wrapper-draft/wrap/methods/static-iswrap.md?ask=<question>
```

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

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