UNPKG

@atlaskit/renderer

Version:
17 lines 620 B
export function isNestedHeaderLinksEnabled(allowHeadingAnchorLinks) { // If it's a boolean or undefined, then we don't support nesting. if (!allowHeadingAnchorLinks || typeof allowHeadingAnchorLinks === 'boolean') { return false; } const { allowNestedHeaderLinks } = allowHeadingAnchorLinks; // Explicit cast to a boolean to cover scenario where it's undefined. return !!allowNestedHeaderLinks; } export function getActiveHeadingId(allowHeadingAnchorLinks) { if (!isNestedHeaderLinksEnabled(allowHeadingAnchorLinks)) { return undefined; } return allowHeadingAnchorLinks.activeHeadingId; }