> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/wrapper/wrap/methods/static/iswrap.md).

# isWrap()

## `Wrap.isWrap()`

The method checks whether the [`value`](#value-any) of any type is the [`Wrap`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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`](/wrapper/wrap/overview.md) 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
