> For the complete documentation index, see [llms.txt](https://wrapper.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://wrapper.angular-package.dev/wrap/constructor.md).

# ★ Constructor

## `Wrap()`

Creates a new [`Wrap`](/wrap/overview.md) instance of the [`opening`](#opening-opening) and [`closing`](#closing-closing) chars and optional [`text`](#text-text) to wrap.&#x20;

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

```typescript
constructor(opening: Opening, closing: Closing, text: Text = '' as Text) {
  super(`${opening}${text}${closing}`);
  this.#closing = String(closing) as Closing;
  this.#text = String(text) as Text;
  this.#opening = String(opening) as Opening;
}
```

{% endcode %}

### Parameters

#### `opening:`[<mark style="color:green;">`Opening`</mark>](/wrap/generic-type-variables.md#wrap-opening)

Opening characters of the generic type variable [`Opening`](/wrap/generic-type-variables.md#wrap-opening) placed before the given [`text`](#text-text). An empty [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) indicates that for the [`hasOpening()`](https://wrapper.angular-package.dev/wrap/pages/AXIumFXCrM0Gvjvp6Ygz#wrap.prototype.hasopening) and [`isWrapped()`](/wrap/methods/instance/iswrapped.md) methods, the [`opening`](/wrap/accessors/opening.md) chars are [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined), returning `false`.

#### `closing:`[<mark style="color:green;">`Closing`</mark>](/wrap/generic-type-variables.md#wrap-closing)

Closing characters of the generic type variable [`Closing`](/wrap/generic-type-variables.md#wrap-closing) placed after the given [`text`](#text-text). An empty [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) indicates that for the [`hasClosing()`](/wrap/methods/instance/hasclosing.md) and [`isWrapped()`](/wrap/methods/instance/iswrapped.md) methods, the [`closing`](/wrap/accessors/closing.md) chars are [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined), returning `false`.

#### `text:`[<mark style="color:green;">`Text`</mark>](https://wrapper.angular-package.dev/wrap/pages/SYPkCWCkQnshiX32nwLt#wrap-less-than...-text-...greater-than)`=`<mark style="color:green;">`''`</mark>

An optional text placed between the given [`opening`](#opening-opening) and [`closing`](#closing-closing) chars on the [template literal](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html) `${Opening}${Text}${Closing}`.

### Returns

The **return value** is a new instance of [`Wrap`](/wrap/overview.md) with the [primitive value](/wrap/methods/instance/valueof.md) of the provided [`opening`](#opening-opening), [`closing`](#closing-closing), and the optional [`text`](#text-text).

## Example usage

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

// Returns Wrap{'[]'}
new Wrap('[', ']');

// Returns Wrap{'nullnull'}
new Wrap(null as any, 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:

```
GET https://wrapper.angular-package.dev/wrap/constructor.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.
