Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thedevsaddam/lo_
A modern Rust utility library delivering modularity, performance & extras proted from JavaScript Lodash
https://github.com/thedevsaddam/lo_
Last synced: 18 days ago
JSON representation
A modern Rust utility library delivering modularity, performance & extras proted from JavaScript Lodash
- Host: GitHub
- URL: https://github.com/thedevsaddam/lo_
- Owner: thedevsaddam
- License: mit
- Created: 2023-11-01T05:53:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-08T19:42:22.000Z (6 months ago)
- Last Synced: 2024-08-10T05:07:32.983Z (3 months ago)
- Language: Rust
- Homepage: https://crates.io/crates/lo_
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Lo_ as Lodash
---
A modern Rust utility library delivering modularity, performance & extras ported from JavaScript Lodash## Usage
Depend on lorust in Cargo.toml:
```toml
[dependencies]
lo_ = "0.1.10"
```#### Example
##### Array
```rust
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
```rust
use lo_::words;fn main() {
let input = "fred, barney, & pebbles";
let result = words(input);
println!("{:?}", result); // ["fred", "barney", "pebbles"]
}```
##### Condition
```rust
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
}```