pub(crate) mod domain_validator;
pub mod hasher;
pub(crate) mod regex_utils;
pub mod string_error;
pub mod string_generator;
pub(crate) mod time_utils;
pub mod url_encoder;
pub mod version;
pub(crate) mod visitor_code_validator;

#[cfg(test)]
pub mod test_utils;

use crate::error::KErr;

pub type KRes<T> = std::result::Result<T, KErr>;

pub(crate) fn eq_ignore_case(a: &str, b_lower: &str) -> bool {
    return a.to_lowercase() == b_lower;
}

#[inline]
pub(crate) fn bool_to_str(value: bool) -> &'static str {
    if value { "true" } else { "false" }
}

#[inline]
pub(crate) fn push_str_json_escaped(dst: &mut String, src: &str) {
    for ch in src.chars() {
        if (ch == '\\') || (ch == '"') {
            dst.push('\\');
        }
        dst.push(ch);
    }
}
