Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const characterCounter = directive(() => (part: PropertyPart) => {
const lastFoundation = partToFoundationMap.get(part);
if (!lastFoundation) {
const hostElement = part.committer.element as CharacterCounter;
hostElement.classList.add('mdc-text-field-character-counter');
const adapter = createAdapter(hostElement);
const foundation = new MDCTextFieldCharacterCounterFoundation(adapter);
foundation.init();
part.setValue(foundation);
partToFoundationMap.set(part, foundation);
}
});