2019-07-22 22:45:31 -04:00
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
use web_sys::{window, Storage};
|
|
|
|
|
|
|
|
|
|
|
|
pub fn local_storage() -> Storage {
|
2022-05-26 08:45:35 -04:00
|
|
|
window().unwrap().local_storage().unwrap().unwrap()
|
2019-07-22 22:45:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-05-28 09:10:10 -04:00
|
|
|
pub fn trim(input: &str) -> Option<&str> {
|
2019-07-22 22:45:31 -04:00
|
|
|
let trimmed = input.trim();
|
|
|
|
|
|
|
|
if trimmed.is_empty() {
|
|
|
|
None
|
|
|
|
|
|
|
|
} else {
|
2021-05-28 09:10:10 -04:00
|
|
|
Some(trimmed)
|
2019-07-22 22:45:31 -04:00
|
|
|
}
|
|
|
|
}
|