[Symbol.toStringTag]

[Symbol.toStringTag]

The get accessor toStringTag of the Symbol changes the default tag String of the instance to the custom tag Wrap. It can be read by the typeOf() function of @angular-package/type.

wrap.class.ts
public get [Symbol.toStringTag](): string {
  return 'wrap';
}

Example usage

// Example usage.
import { Wrap } from '@angular-package/wrapper';
import { typeOf } from '@angular-package/type';

// Define the wrap.
const tagWrap = new Wrap('[', ']');

// Returns [object Wrap].
Object.prototype.toString.call(tagWrap);

// Returns wrap.
typeOf(tagWrap);

Last updated