pub fn singular<T, F>(input: T) -> F
where
    T: Into<String>,
    F: From<String>,
{
    let m = input.into();
    if let Ok(s) = COMPILED_SINGULAR_MAPS.read() {
        for x in s.iter() {
            if x.regex.is_match(&m) {
                return From::from(x.regex.replace(&m, x.replace.as_str()).to_string());
            }
        }
    }

    From::from(m)
}
/// singular converts a word to its singular form
/// # example
/// ```
/// use inflection::singular;
///
/// assert_eq!(singular::<_, String>("people"), "person".to_string());
/// assert_eq!(singular::<_, String>("PEOPLE"), "PERSON".to_string());
/// assert_eq!(singular::<_, String>("buses"), "bus".to_string());
/// assert_eq!(singular::<_, String>("People"), "Person".to_string());
/// assert_eq!(singular::<_, String>("BUSES"), "BUS".to_string());
/// assert_eq!(singular::<_, String>("Buses"), "Bus".to_string());
/// assert_eq!(singular::<_, String>("FancyPeople"), "FancyPerson".to_string());
/// ```
singular converts a word to its singular form
singular converts a word to its singular form
pub fn singular<T, F>(input: T) -> F
where
    T: Into<String>,
    F: From<String>,
{
    let m = input.into();
    if let Ok(s) = COMPILED_SINGULAR_MAPS.read() {
        for x in s.iter() {
            if x.regex.is_match(&m) {
                return From::from(x.regex.replace(&m, x.replace.as_str()).to_string());
            }
        }
    }
    From::from(m)
}
pub fn singular < T , F > ( input : T ) -> F where T : Into < String > , F : From < String > , { let m = input . into ( ) ; if let Ok ( s ) = COMPILED_SINGULAR_MAPS . read ( ) { for x in s . iter ( ) { if x . regex . is_match ( & m ) { return From :: from ( x . regex . replace ( & m , x . replace . as_str ( ) ) . to_string ( ) ) ; } } } From :: from ( m ) }
singular converts a word to its singular form
singular converts a word to its singular form
input
T
input
T
example
```
use inflection::singular.

assert_eq!(singular::<_, String>("people"), "person".to_string());
assert_eq!(singular::<_, String>("PEOPLE"), "PERSON".to_string());
assert_eq!(singular::<_, String>("buses"), "bus".to_string());
assert_eq!(singular::<_, String>("People"), "Person".to_string());
assert_eq!(singular::<_, String>("BUSES"), "BUS".to_string());
assert_eq!(singular::<_, String>("Buses"), "Bus".to_string());
assert_eq!(singular::<_, String>("FancyPeople"), "FancyPerson".to_string());
```
` ` ` use inflection :: singular . assert_eq! ( singular :: <_ String > ( " people " ) " person " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " PEOPLE " ) " PERSON " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " buses " ) " bus " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " People " ) " Person " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " BUSES " ) " BUS " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " Buses " ) " Bus " . to_string () ) ; assert_eq! ( singular :: <_ String > ( " FancyPeople " ) " FancyPerson " . to_string () ) ; ` ` `