Wrapped() constructor
Wrapped()
Wrapped()
Creates a new instance of Wrapped
with the specified text and wrap.
constructor(text: Text, wrap: Wrap<Opening, Closing>) {
super(Wrapped.template`${text}${wrap}`);
this.#closing = wrap.closing;
this.#opening = wrap.opening;
this.#text = text;
}
Generic type variables
Parameters
Name: type
Description
text: Text
The value of a generic type variable Text
to be wrapped with a given wrap
.
wrap: Wrap<Opening, Closing>
An instance of Wrap
to wrap a given text
.
Returns
The return value is a new instance of Wrapped
with the primitive value of the provided text
if set properly, otherwise with an empty string
.
Example usage
// Example usage.
import { Wrap, Wrapped } from '@angular-package/text';
const wrap = new Wrap(`[`, `]`);
// Returns Wrapped {'[[OH no, you wrapped me]]'}
new Wrapped(`[OH no, you wrapped me]`, wrap);
// Returns Wrapped{'[]'}
new Wrapped(null as any, wrap);
Last updated
Was this helpful?