Debian Codegraph @

path2/_get-dirname-fn.js

raw
1 'use strict';
2
3 module.exports = function (splitPath) {
4 return function (path) {
5 var result = splitPath(path),
6 root = result[0],
7 dir = result[1];
8
9 if (!root && !dir) {
10 // No dirname whatsoever
11 return '.';
12 }
13
14 if (dir) {
15 // It has a dirname, strip trailing slash
16 dir = dir.substr(0, dir.length - 1);
17 }
18
19 return root + dir;
20 };
21 };