Function nodejs_path::parse[][src]

pub fn parse(path: &str) -> Parsed
Expand description

Example

assert_eq!(nodejs_path::parse("/home/user/dir/file.txt"), nodejs_path::Parsed{
  root: "/".to_string(),
  dir: "/home/user/dir".to_string(),
  base: "file.txt".to_string(),
  ext: ".txt".to_string(),
  name: "file".to_string(),
})
┌─────────────────────┬────────────┐
│          dir        │    base    │
├──────┬              ├──────┬─────┤
│ root │              │ name │ ext │
"  /    home/user/dir / file  .txt "
└──────┴──────────────┴──────┴─────┘
(All spaces in the "" line should be ignored. They are purely for formatting.)