#lodash #rustlodash #arraymanipulation #arraymethods

highdash

A lodash alternative for Rust. Great package for people coming from Javascript

2 releases

0.0.1 Mar 4, 2023
0.0.0 Mar 4, 2023

#9 in #lodash

MIT license

9KB
175 lines

Highdash

The lodash alternative in Rust.

You have decided switch to Rust from JavaScript but are missing some of the cool libraries such as lodash. This library tries to implement Lodash in rust and gives the experience as close as possible to lodash. Currently It is in development and has only implemented a few array methods. I am constantly working on it and adding new features. Hopefully this library will serve its purpose.

Installation

cargo add highdash

Example

use highdash::{gstr, map};

#[allow(unused)]
#[derive(Debug)]
struct User {
    name: String,
    age: i32,
}
fn main() {
    let user = User {
        name: gstr("Himanshu"),
        age: 20,
    };

    // It works for both arrays and vectors
    let users1 = vec![user];

    let names_only = map::<User, String>(&users1, |user, _i| return format!("{_i}: {}", user.name));

    print!("{:?}", names_only);
}

// Output: ["0: Himanshu"]

Currently, Open For Contribution

Thanks for visiting!

Made by Vedik Dev: Himanshu Jangid

No runtime deps