@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
19 lines (18 loc) • 332 B
JavaScript
import { REGEX } from "@scalar/helpers/regex/regex-helpers";
const getRefName = (schema) => {
if (!("$ref" in schema)) {
return null;
}
const ref = schema.$ref;
if (!ref) {
return null;
}
const match = ref.match(REGEX.REF_NAME);
if (match) {
return match[1];
}
return null;
};
export {
getRefName
};