[Symbol.toStringTag]

[Symbol.toStringTag]

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

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

Example usage

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

const quote = new Wrapper('[', ']', 'quote');

// Returns [object Wrapper].
Object.prototype.toString.call(quote);

// Returns wrapper.
typeOf(quote);

Last updated