# isWrapper()

## `Wrapper.isWrapper()`

The method checks if the [`value`](#value-any) of any type is an instance of the [`Wrapper`](/wrapper/overview.md) of any, or given [`opening`](#opening-opening), [`closing`](#closing-closing) chars, and [`text`](#text-text).

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

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

{% endcode %}

### Generic type variables

#### <mark style="color:green;">**`Opening`**</mark>**`extends`**<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 type of the opening in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

#### <mark style="color:green;">**`Closing`**</mark>**`extends`**<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 type of the closing in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

#### <mark style="color:green;">**`Text`**</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 [`text`](#text-text) indicates the type of the text in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

### Parameters

#### `value: any`

The **value** of any type to test against the instance of [`Wrapper`](/wrapper/overview.md).

#### `opening?: Opening`

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

#### `closing?: Closing`

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

#### `text?: Text`

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

### Return type

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

The **return type** is a [boolean](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) that indicates the [`value`](#value-any) is the [`Wrapper`](/wrapper/overview.md) instance.

### 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 [`Wrapper`](/wrapper/overview.md) of any, or the given [`opening`](#opening-opening), [`closing`](#closing-closing) chars, and [`text`](#text-text).

## Example usage

### Returns `true`

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

const tagWrapper = new Wrapper('[', ']', 'quote');

// Returns true confirming the type Wrapper<string, string, string>
Wrapper.isWrapper(tagWrapper);

// Returns true confirming the type Wrapper<"[", string, string>
Wrapper.isWrapper(tagWrapper, '[');

// Returns true confirming the type Wrapper<"[", string, "]">
Wrapper.isWrapper(tagWrapper, '[', ']');

// Returns true confirming the type Wrapper<"[", "quote", "]">
Wrapper.isWrapper(tagWrapper, '[', ']', 'quote');

// Returns true confirming the type Wrapper<string, "quote", "]">
Wrapper.isWrapper(tagWrapper, undefined, ']', 'quote');

// Returns true confirming the type Wrapper<"[", "quote", string>
Wrapper.isWrapper(tagWrapper, '[', undefined, 'quote');

// Returns true confirming the type Wrapper<string, "quote", string>
Wrapper.isWrapper(tagWrapper, undefined, undefined, 'quote');

// Returns true confirming the type Wrapper<string, string, "]">
Wrapper.isWrapper(tagWrapper, undefined, ']');

// Returns true confirming the type Wrapper<"[", string, "]">
Wrapper.isWrapper<'[', ']'>(tagWrapper);
```

### Return `false`

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

const tagWrapper = new Wrapper('[', ']', 'quote');

// Returns false denying the type Wrapper<"<", string, string>
Wrapper.isWrapper(tagWrapper, '<');

// Returns false denying the type Wrapper<"<", string, ">">
Wrapper.isWrapper(tagWrapper, '<', '>');

// Returns false denying the type Wrapper<"<", "quote", ">">
Wrapper.isWrapper(tagWrapper, '<', '>', 'quote');

// Returns false denying the type Wrapper<string, "quote", ">">
Wrapper.isWrapper(tagWrapper, undefined, '>', 'quote');

// Returns false denying the type Wrapper<"<", "quote", string>
Wrapper.isWrapper(tagWrapper, '<', undefined, 'quote');

// Returns false denying the type Wrapper<string, "no-quote", string>
Wrapper.isWrapper(tagWrapper, undefined, undefined, 'no-quote');

// Returns false denying the type Wrapper<string, string, ">">
Wrapper.isWrapper(tagWrapper, undefined, '>');

// Returns false denying the type Wrapper<"[", "", "]">
Wrapper.isWrapper<'[', ']'>(null as any);
```

### Confirms the wrong type

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

const tagWrapper = new Wrapper('[', ']', 'quote');

// Returns true confirming the type Wrapper<"<", string, ">">
Wrapper.isWrapper<'<', '>'>(tagWrapper);
```


---

# 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/methods/static/iswrapper.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.
