declutter 0.1.0

declutter url lists
Documentation
//! Declutter url lists
//!
//! * Match extensions, i.e.: `html`, `js`, `php`
//! * Filter extensionless
//! * Filter extensions, i.e.: `jpg`, `css`, `pdf`
//! * Filter keywords, i.e.: `bootstrap`, `jquery`, `node_modules`
//!
//! See [`Budget`] to configure the behavior and [`Declutter`] to get started.

pub struct Budget<'b> {
    /// Does urls without a file extension be allowed
    ///
    /// The following urls are considered as extensionless:
    ///
    /// 1. `https://localhost`
    /// 2. `https://localhost/`
    /// 3. `https://localhost/hello`
    ///
    /// # Example
    ///
    /// ```rust
    /// true
    /// ```
    allow_extensionless: bool,

    /// Allow only the given file extensions
    ///
    /// # Example
    ///
    /// ```rust
    /// Some(&["html", "php", "js"])
    /// ```
    allow_extensions: Option<&'b [&'b str]>,

    /// Deny the given file extensions
    ///
    /// # Example
    ///
    /// ```rust
    /// Some(&["css", "scss", "webp", "ico", "jpg", "jpeg", "png", "svg", "bmp", "gif", "eot", "mp3", "mp4", "mkv", "avi", "wav", "tif", "tiff", "ttf", "otf", "woff", "woff2"])
    /// ```
    deny_extensions: Option<&'b [&'b str]>,

    /// Filter urls based on a keyword list.
    ///
    /// # Example
    ///
    /// ```rust
    /// Some(&["bootstrap", "jquery", "node_modules"])
    /// ```
    deny_keywords: Option<&'b [&'b str]>,
}

/// Run matchers and filterers against urls
///
/// # See Also
///
/// [`Budget`]
pub struct Declutter<'b> {
    budget: Budget<'b>,
}