1export const STORY_TYPES = [ 2 { value: 'announcement', label: 'Announcement' }, 3 { value: 'download', label: 'Download' }, 4 { value: 'try-now', label: 'Try now' }, 5 { value: 'release', label: 'Release' }, 6 { value: 'blog', label: 'Blog' } 7]; 8 9export const DEFAULT_STORY_TYPE = 'announcement'; 10 11const STORY_TYPE_LABELS = Object.fromEntries( 12 STORY_TYPES.map(({ value, label }) => [value, label]) 13); 14 15export function getStoryTypeLabel(type) { 16 const normalized = normalizeStoryTypeValue(type); 17 return STORY_TYPE_LABELS[normalized] || STORY_TYPE_LABELS[DEFAULT_STORY_TYPE]; 18} 19 20export function getStoryTypeClassName(type) { 21 const normalized = normalizeStoryTypeValue(type); 22 return normalized === 'announcement' ? ' extra-type--announcement' : ''; 23} 24 25export function normalizeStoryTypeValue(type) { 26 if (typeof type !== 'string') return DEFAULT_STORY_TYPE; 27 28 const trimmed = type.trim().toLowerCase(); 29 if (STORY_TYPE_LABELS[trimmed]) return trimmed; 30 31 const aliasMatch = STORY_TYPES.find((item) => item.label.toLowerCase() === trimmed); 32 return aliasMatch ? aliasMatch.value : DEFAULT_STORY_TYPE; 33} 34 35export function isValidStoryType(type) { 36 return STORY_TYPES.some((item) => item.value === type); 37}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.