rok-utils 0.2.0

Laravel/AdonisJS-inspired utility helpers for the Rok ecosystem
Documentation
//! rok-utils — Laravel/AdonisJS-inspired utility helpers for Rust.

pub mod arr;
pub mod data;
pub mod errors;
pub mod fp;
pub mod fs;
pub mod path;
pub mod result;
pub mod str;
pub mod string;
pub mod types;

pub use arr::*;
pub use data::numbers;
pub use errors::ResultExt as RokResultExt;
pub use errors::{ResultExt, RokError};
pub use fp::{apply, compose, memoize, or_default, pipe, retry, tap, Lazy};
pub use fs::{
    copy_dir_all, ensure_dir, find_files, is_dir, is_file, read_bytes, read_to_string, write_atomic,
};
pub use path::{normalize, stem_ext, with_extension};
pub use str::{to_base64, Str};
pub use string::{
    char_at, contains, contains_all, doesnt_contain, ends_with, ensure_start, finish, invert_case,
    is_alphanumeric, is_ascii, is_empty, is_url, lcfirst, length, mask, pad_both, pad_left,
    pad_right, pluralize, position, pretty_duration, repeat, replace_first, replace_last, reverse,
    slug, squish, starts_with, substr_count, to_camel_case, to_dot_case, to_headline,
    to_kebab_case, to_lower, to_no_case, to_pascal_case, to_screaming_snake, to_sentence_case,
    to_snake_case, to_title_case, to_upper, truncate, ucfirst, unwrap, word_count, wrap,
};

#[cfg(feature = "dates")]
pub use data::{
    add_days, add_hours, diff_days, format_date, human_diff, now, parse_date, today, tomorrow,
    yesterday,
};

#[cfg(feature = "crypto")]
pub use data::{generate_token, hash_sha256, secure_compare, verify_sha256};

#[cfg(feature = "ids")]
pub use data::{is_ulid, is_uuid, ulid, uuid_v4, uuid_v7};

#[cfg(feature = "random")]
pub use string::{password, random};

#[cfg(feature = "json")]
pub use str::escape_html;

#[cfg(feature = "json")]
pub use string::is_json;

#[cfg(feature = "json")]
pub use types::{
    deep_equal, get_path, is_array, is_bool, is_null, is_number, is_object, is_string, set_path,
};

#[cfg(feature = "random")]
pub use fp::shuffle;

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert!(true);
    }
}