drupal-attribute
Version:
Emulate Drupal Attribute in JavaScript.
18 lines (17 loc) • 880 B
text/typescript
export type DrupalAttributeEntry = string | Array<string> | Record<string, any> | boolean | null | undefined;
export interface DrupalAttribute extends Map<string, DrupalAttributeEntry> {
addClass(...args: Array<DrupalAttributeEntry | Map<string, string>>): this;
hasClass(key: string): boolean;
removeClass(value: string | Array<string>): this;
}
export declare class DrupalAttribute extends Map<string, DrupalAttributeEntry> {
getClasses(): Array<string> | null;
setAttribute(key: string, value: DrupalAttributeEntry): this;
removeAttribute(key: string): this;
toString(): string;
/**
* Merge another DrupalAttribute instance into this one.
*/
merge(collection: DrupalAttribute): this;
mergeDeep(target: Record<string, DrupalAttributeEntry>, source: Record<string, DrupalAttributeEntry>): Record<string, DrupalAttributeEntry>;
}