@terrazzo/token-tools
Version:
Various utilities for token types
26 lines • 1.19 kB
TypeScript
import wcmatch from 'wildcard-match';
/** Is this token an alias of another? */
export declare function isAlias(value: string): boolean;
/** Only create unique wcmatch instances, and cache across the lifespan of a run */
export declare class CachedWildcardMatcher {
cachedMatchers: Record<string, ReturnType<typeof wcmatch>>;
/** This is a separate cache because of the "." separator. */
cachedTokenIDMatchers: Record<string, ReturnType<typeof wcmatch>>;
constructor();
/** Generic wildcard matcher */
match(...params: Parameters<typeof wcmatch>): ReturnType<typeof wcmatch>;
/** Wildcard matcher specifically for Token IDs (provides "." as separator). */
tokenIDMatch(pattern: Parameters<typeof wcmatch>[0]): ReturnType<typeof wcmatch>;
/** Garbage collect all caches, reset to initial state */
reset(): void;
}
/** Make an alias */
export declare function makeAlias(input: string): string;
/** Parse an alias */
export declare function parseAlias(input: string): string;
/** split a token ID into a local ID and group ID */
export declare function splitID(id: string): {
local: string;
group?: string;
};
//# sourceMappingURL=id.d.ts.map