toObject()

Attribute.prototype.toObject()

Returns attribute primitive value converted to the object where the property key is the attribute name, and property value is the attribute value.

attribute.class.ts
public toObject(): Readonly<{ [key in Name]: Value }> {
  return Object.freeze({
    [this.#name]: this.#value,
  }) as { [key in Name]: Value };
}

Returns

The return value is the attribute of a read-only object.

Example usage

// Example usage.
import { Attribute } from '@angular-package/tag';

Last updated