Expand description
A library for javascript lodash methods in rustlang
This library methods is meant to give the same output as their equivalent in javascript, if you notice any bugs or differences please on an issue.
§Usage
First, add this to your Cargo.toml
[dependencies]
lodash_rust = "0.1.0"
Next:
use lodash_rust::capitalize;
fn main() {
let greet = String::from("hello world");
let res = capitalize::new(greet);
println!("{res}") // Hello world
}
Modules§
- camel_
case - Converts
String
to camel case. - capitalize
- Converts the first character of
String
to upper case and the remaining to lower case. - difference
- Creates an array of
array
values not included in the other given arrays usingSameValueZero
- drop
- Creates a slice of
array
withn
elements dropped from the beginning. - drop_
right - Creates a slice of
array
withn
elements dropped from the end. - drop_
right_ while - Creates a slice of
array
excluding elements dropped from the end. Elements are dropped untilpredicate
returns falsy. - drop_
while - Creates a slice of
array
excluding elements dropped from the beginning. Elements are dropped untilpredicate
returns falsy. - every
- Checks if
predicate
returns truthy for all elements ofarray
Iteration is stopped oncepredicate
returns falsy. The predicate is Note: This method returnstrue
for empty vector because everything is true of elements of empty vector. - every_
value - Checks if
predicate
returns truthy for all properties ofHashMap
. Iteration is stopped oncepredicate
returns falsy. The predicate is - filter
- Iterates over elements of
array
, returning an array of all elementspredicate
returns truthy for. - find_
key - This method is like
find
except that it returns the key of the first elementpredicate
returns truthy for instead of the element itself. - find_
last - This method is like
find
except that it iterates over elements ofcollection
from right to left. - find_
last_ index - This method is like
findIndex
except that it iterates over elements ofcollection
from right to left. - kebab_
case - Converts
String
to kebab case. This method is likefind
except that it iterates over elements ofcollection
from right to left. - lower_
case - Converts
string
, as space separated words, to lower case. - snake_
case - Converts
String
to snake case. - start_
case - Converts
String
to start case. - upper_
case - Converts
string
, as space separated words, to upper case. - upper_
first - Converts the first character of
string
to upper case.