# Static methods

## Public

### `isTag()`

The static method checks whether the provided `value` of any type is an instance of [`Tag`](https://docs.angular-package.dev/text/tag/tag).

```typescript
public static isTag<Name extends string, Chars extends string = string>(
  value: any,
  name?: Name,
  chars?: Chars
): value is Tag<Name, Chars> {
  return isInstance(value, Tag)
    ? isDefined(name) || isDefined(chars)
      ? isDefined(name) && isDefined(chars)
        ? value.wrap.value === chars && value.name === name
        : isDefined(name)
        ? value.name === name
        : value.wrap.value === chars
      : true
    : false;
}
```

#### Generic type variables

<table><thead><tr><th>Name / Description</th><th data-hidden>Name</th></tr></thead><tbody><tr><td><p><strong><code>Name extends string</code></strong></p><p>​A generic type variable constrained by a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"><code>string</code></a> by default of the value captured from the provided <code>name</code> indicates the text type of <a href=""><code>Tag</code></a> via the return type.</p></td><td><code>Chars</code></td></tr><tr><td><p><strong><code>Chars extends string</code></strong></p><p>​A generic type variable constrained by a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"><code>string</code></a> by default of the value captured from the provided <code>chars</code> parameter indicates the chars type of <a href=".."><code>Tag</code></a> via the return type.</p></td><td></td></tr></tbody></table>

#### Parameters

| Name: type      | Description                                                                                                |
| --------------- | ---------------------------------------------------------------------------------------------------------- |
| `value: any`    | The value of any type to test against the [`Tag`](https://docs.angular-package.dev/text/tag/tag) instance. |
| `name?: Name`   | An optional tag name of a generic type variable `Name`.                                                    |
| `chars?: Chars` | An optional wrap of a generic type variable `Chars`.                                                       |

#### Returns

| Return type                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><strong><code>value is Tag\<Name, Chars></code></strong></p><p>The return type is a <code>boolean</code> indicating the <code>value</code> parameter is an instance of <a href=".."><code>Tag</code></a> that takes a generic type variable <code>Name</code> the tag name and <code>Chars</code> the wrap.</p> |

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the value is the [`Tag`](https://docs.angular-package.dev/text/tag/tag) instance of any or given name, or of any or given wrap.

#### Example usage

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

// Define the tag.
const quote = new Tag(`quote`);

// Returns `true`
Tag.isTag(quote, `quote`);

// Returns `true`
Tag.isTag(quote, `quote`, '[]');

// Returns `false`
Tag.isTag(quote, `quote`, '()');
```
