#array-string #javascript #utility #lodash #js #rust-lodash

lo_

A modern Rust utility library delivering modularity, performance & extras ported from JavaScript Lodash

11 releases

0.1.10 May 8, 2024
0.1.9 Mar 31, 2024
0.1.7 Nov 5, 2023
0.1.3 Oct 31, 2023

#1434 in Web programming

Download history 21/week @ 2024-07-21 122/week @ 2024-07-28 90/week @ 2024-08-04 146/week @ 2024-08-11 107/week @ 2024-08-18 124/week @ 2024-08-25 78/week @ 2024-09-01 20/week @ 2024-09-08 1/week @ 2024-09-15 42/week @ 2024-09-22 5/week @ 2024-09-29 358/week @ 2024-10-06 1/week @ 2024-10-13 18/week @ 2024-10-20

377 downloads per month

MIT license

34KB
748 lines

Lo_ as Lodash

A modern Rust utility library delivering modularity, performance & extras ported from JavaScript Lodash

Usage

Depend on lorust in Cargo.toml:

[dependencies]
lo_ = "0.1.10"

Example

Array
use lo_::chunk;

fn main() {
    let array = vec![1, 2, 3, 4, 5, 6, 7];
    let size = 3;
    let chunks = chunk(array, size);
    println!("array chunks: {:?}", chunks); // array chunks: [[1, 2, 3], [4, 5, 6], [7]]
}
String
use lo_::words;

fn main() {
    let input = "fred, barney, & pebbles";
    let result = words(input);
    println!("{:?}", result); // ["fred", "barney", "pebbles"]
}

Condition
use lo_::ternary;

let iam_tom_or_zerry = |args: i32| -> String {
    if args == 1 {
        String::from("Tom")
    } else {
        String::from("Zerry")
    }
};

fn main() {
    println!("{:?}", ternary("Tom" == iam_tom_or_zerry(1), "Yes", "No")); // Yes
    println!("{:?}", ternary("Tom" == iam_tom_or_zerry(2), "Yes", "No")); // No
}

Dependencies

~0–520KB