For the complete documentation index, see llms.txt. This page is also available as Markdown.

Static methods

Public

Wrapped.isWrapped()

The static method checks whether the provided value of any type is an instance of Wrapped.

wrapped.class.ts
public static isWrapped<
  Text extends string,
  Opening extends string = string,
  Closing extends string = string
>(
  value: any,
  opening?: Opening,
  closing?: Closing
): value is Wrapped<Text, Opening, Closing> {
  return isInstance(value, Wrapped)
    ? isStringType(opening) && isStringType(closing)
      ? closing === value.closing && opening === value.opening
      : isStringType(opening)
      ? opening === value.opening
      : isStringType(closing)
      ? closing === value.closing
      : true
    : false;
}
Generic type variables

Text extends string

​A generic type variable constrained by a string indicates the text type of Wrapped in the return type.

Opening extends string

A generic type variable constrained by the string, by default of the value captured from the provided opening indicates the opening type of a checked Wrapped instance.

Closing extends string

A generic type variable constrained by the string, by default of the value captured from the provided closing indicates the closing type of a checked Wrapped instance.

Parameters

Name: type
Description

value: any

The value of any type to test against the Wrapped instance.

opening?: Opening

An optional opening of the wrap to check if the given value contains.

closing?: Closing

An optional closing of the wrap to check if the given value contains.

Returns

Return type

value is Wrapped<Text, Opening, Closing>

The return type is a boolean indicating the value parameter is an instance of Wrapped that takes a generic type variable Opening and Closing of the wrap and Text of the wrapped text.

The return value is a boolean indicating whether the value is the Wrapped instance of any or given wrap.

Example usage

Wrapped.template()

The static "tag" method builds the wrapped text of a string type on the template literal. It consists of a text and an instance of Wrap.

Parameters

Name: type
Description

template: TemplateStringsArray

An array of string values where the first element is a text between opening and closing.

...values: any[]

A rest parameter of expressions, where the first element is the text and the second is an instance of Wrap.

Returns

The return value is a string the wrapped text, or an empty string if elements of the provided values are not string.

Example usage

Last updated