@jeswr/prefixcc
Version:
A utility library to lookup prefixes and uris on prefixcc
31 lines (30 loc) • 1.22 kB
TypeScript
/**
* Look up the prefix for a given URI
* @param uri The URI to lookup the prefix for
* @param options
* - If mintOnUnknown is set to true then a custom prefix will
* be minted when prefix.cc does not return a result.
* - If existingPrefixes are provided then uriToPrefix will ensure
* that a prefix not already found in the keys of the provided record
* is returned.
* - You can optionally pass a custom fetch function.
*/
export declare function uriToPrefix(uri: string, options: {
mintOnUnknown: true;
fetch?: typeof fetch;
existingPrefixes?: Record<string, any>;
}): Promise<string>;
export declare function uriToPrefix(uri: string, options?: {
mintOnUnknown?: boolean;
fetch?: typeof fetch;
existingPrefixes?: Record<string, any>;
}): Promise<string | undefined>;
/**
* Lookup the namespace commonly associated with a given prefix
* @param prefix The prefix to lookup the namespace for
* @param options You can optionally pass a custom fetch function
*/
export declare function prefixToUri(prefix: string, options?: {
fetch?: typeof fetch;
}): Promise<string | undefined>;
export { lookupAllPrefixes } from './lookup';