dirname.js 289 B

123456789101112131415
  1. var utils = require('../utils')
  2. , path = require('path');
  3. /**
  4. * Return the dirname of `path`.
  5. *
  6. * @param {String} path
  7. * @return {String}
  8. * @api public
  9. */
  10. module.exports = function dirname(p){
  11. utils.assertString(p, 'path');
  12. return path.dirname(p.val).replace(/\\/g, '/');
  13. };