Skip to content

Instantly share code, notes, and snippets.

@nopjia
Created September 25, 2015 00:29
Show Gist options
  • Save nopjia/bf710eb34a00f355f307 to your computer and use it in GitHub Desktop.
Save nopjia/bf710eb34a00f355f307 to your computer and use it in GitHub Desktop.

Revisions

  1. nopjia created this gist Sep 25, 2015.
    7 changes: 7 additions & 0 deletions basename.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    var basename = function(path) {
    return path.replace(/\\/g, "/").replace( /.*\//, "");
    };

    var dirname = function(path) {
    return path.replace(/\\/g, "/").replace(/\/[^\/]*$/, "");
    };