1// @ts-check 2/** 3 * Build a safe download filename (pure): replace unsafe characters with underscores, 4 * collapse runs, trim leading/trailing separators, fall back to a default, and append 5 * the extension (avoiding a double dot). 6 * @param {string} name 7 * @param {string} [ext] extension without the dot (e.g. 'csv') 8 * @returns {string} 9 */ 10export function slugifyFilename(name, ext = '') { 11 let base = String(name || '') 12 .trim() 13 .replace(/[^\w.-]+/g, '_') 14 .replace(/_+/g, '_') 15 .replace(/^[_.]+|[_.]+$/g, ''); 16 if (!base) base = 'export'; 17 const e = String(ext || '').replace(/^\.+/, ''); 18 return e ? `${base}.${e}` : base; 19}
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.