@stacktrace-lite/core
    Preparing search index...

    Type Alias FilterOptions

    Utilities for filtering parsed stack frames.

    This module exposes a flexible filterStack function that lets you:

    • Exclude noisy frames (e.g., from node_modules, bundlers, internals).
    • Include only frames that match your app files.
    • Use ready-made presets for common scenarios.

    The filtering logic supports both regular expressions (tested against frame.fileName) and predicate functions that receive the full StackFrame.

    // Keep only app frames from src/, drop everything in node_modules by default:
    const frames = parseStack(err); // returns StackFrame[]
    const appFrames = filterStack(frames, {
    preset: 'app-only',
    include: [//src//], // keep anything inside /src/
    });
    type FilterOptions = {
        exclude?: (RegExp | ((frame: StackFrame) => boolean))[];
        include?: (RegExp | ((frame: StackFrame) => boolean))[];
        preset?: "app-only" | "all" | "minimal";
    }
    Index

    Properties

    exclude?: (RegExp | ((frame: StackFrame) => boolean))[]

    Block-list of matchers. If a frame matches any of these, it is removed.

    • A RegExp is tested against frame.fileName.
    • A function receives the full StackFrame and should return true to exclude it.
    // Drop test helpers and any vite-related frames:
    exclude: [/\.test\./, /vitest|vite/]
    include?: (RegExp | ((frame: StackFrame) => boolean))[]

    Allow-list of matchers. If provided, a frame must match at least one entry here to be kept.

    • A RegExp is tested against frame.fileName (empty string if missing).
    • A function receives the full StackFrame and should return true to keep it.
    // Keep only files under /app/ or any frame whose function name includes "handle":
    include: [//app//, (f) => (f.functionName ?? '').includes('handle')]
    preset?: "app-only" | "all" | "minimal"

    Convenience defaults for common use-cases:

    • 'app-only': Excludes node_modules, bundlers (e.g. webpack), internal frames, <anonymous>, and native. Best for user-facing stack displays.
    • 'all': No additional defaults; only include/exclude determine results.
    • 'minimal': Excludes only node_modules and <anonymous>.