doi-utils
Version:
Set of utility functions to help with handling DOI(Digital Object Identifier)
43 lines (42 loc) • 1.41 kB
TypeScript
import { validatePart } from './validatePart.js';
export { DEFAULT_RESOLVERS, STRICT_RESOLVERS } from './resolvers.js';
export declare const OPEN_FUNDER_REGISTRY_PREFIX = "10.13039";
export type Options = {
strict?: boolean;
};
/**
* Validate that the input string is valid.
*
* Uses DOI pattern described here: https://www.crossref.org/blog/dois-and-matching-regular-expressions/
*
* @param possibleDOI
* @returns true if DOI is valid
*/
export declare function validate(possibleDOI?: string | null, opts?: Options): boolean;
/**
* Normalize an input string to the component of the DOI
*
* @param possibleDOI
* @returns a string if it is valid
*/
export declare function normalize(possibleDOI?: string | null, opts?: Options): string | undefined;
/**
* Builds a canonical URL pointing to https://doi.org
*
* @param possibleDOI
* @returns the doi as a string
*/
export declare function buildUrl(possibleDOI?: string | null, opts?: Options): string | undefined;
/**
* Returns `true` if the DOI is in the Open Funder Registry
*
* See https://www.crossref.org/documentation/funder-registry/
*/
export declare function isOpenFunderRegistry(possibleDOI?: string): boolean;
export declare const doi: {
validatePart: typeof validatePart;
validate: typeof validate;
normalize: typeof normalize;
buildUrl: typeof buildUrl;
isOpenFunderRegistry: typeof isOpenFunderRegistry;
};