# ★ Constructor

## `Wrap()`

Creates a new [`Wrap`](/wrapper/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>](/wrapper/wrap/generic-type-variables.md#wrap-opening)

Opening characters of the generic type variable [`Opening`](/wrapper/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://docs.angular-package.dev/wrapper/wrap/pages/AXIumFXCrM0Gvjvp6Ygz#wrap.prototype.hasopening) and [`isWrapped()`](/wrapper/wrap/methods/instance/iswrapped.md) methods, the [`opening`](/wrapper/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>](/wrapper/wrap/generic-type-variables.md#wrap-closing)

Closing characters of the generic type variable [`Closing`](/wrapper/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()`](/wrapper/wrap/methods/instance/hasclosing.md) and [`isWrapped()`](/wrapper/wrap/methods/instance/iswrapped.md) methods, the [`closing`](/wrapper/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://docs.angular-package.dev/wrapper/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`](/wrapper/wrap/overview.md) with the [primitive value](/wrapper/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: 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://docs.angular-package.dev/wrapper/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.
