UNPKG

normalize-path

Version:

Normalize file path slashes to be unix-like forward slashes, regardless of OS (since in reality Windows doesn't care about slash direction anyway). Also condenses repeat slashes to a single slash and removes and trailing slashes.

17 lines (14 loc) 336 B
/*! * normalize-path * https://github.com/jonschlinkert/normalize-path * * Copyright (c) 2014 Jon Schlinkert, contributors. * Licensed under the MIT License */ 'use strict'; var path = require('path'); module.exports = function(filepath) { return path.normalize(filepath) .replace(/\\/g, '/') .replace(/\/$/g, ''); };