NamePolicy context
const NamePolicyContext: ComponentContext<NamePolicy<string>>
Accessor
Section titled “Accessor”import { useNamePolicy } from "@alloy-js/core";
const myContext = useNamePolicy();
Context interface
Section titled “Context interface”for | (TElements | undefined) => NamePolicyGetter | Get a function that takes a name and applies the naming policy to it. |
getName | (string, TElements | undefined) => string | Apply the language policy to the provided name for the provided element type. |
Factory
Section titled “Factory”import { createNamePolicy } from "@alloy-js/core";
function createNamePolicy<T extends string>(namer: (name: string, elements: T) => string): NamePolicy<T>;