dprint 0.16.0

Binary for dprint code formatter—a pluggable and configurable code formatting platform.
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::path::Path;

pub fn get_lowercase_file_extension(file_path: &Path) -> Option<String> {
  if let Some(ext) = file_path.extension().and_then(|e| e.to_str()) {
    Some(String::from(ext).to_lowercase())
  } else {
    None
  }
}

pub fn get_lowercase_file_name(file_path: &Path) -> Option<String> {
  file_path.file_name().and_then(|s| s.to_str()).map(|s| s.to_lowercase())
}