Examples

Let's create a new HtmlWrap object extending it with the Wrapper to make an immutable <span> tag.

// Example usage.
import { Wrapper } from '@angular-package/text';
 
// Define HtmlWrap class.
class HtmlWrap extends Wrapper<`<`, `>`> {
  constructor() {
    super(`<`, `>`);
  }
}

// Create the html tag '<span>'.
new HtmlWrap().wrapText(`span`).value;

Create a new object OfType to make an immutable string indicating of type : Opening.

// Example usage.
import { Wrapper } from '@angular-package/text';
 
class OfType extends String {
  constructor(name: string) {
    super(new Wrapper<`:`, ``>(`:`, ``).wrapText(` ${name}`));
  }
}

// Returns OfType{': Opening'}.
const ofOpening = new OfType(`Opening`);

// Returns ': Opening'.
ofOpening.valueOf();

Last updated