source: node_modules/@fastify/busboy/lib/utils/basename.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 420 bytes
RevLine 
[d24f17c]1'use strict'
2
3module.exports = function basename (path) {
4 if (typeof path !== 'string') { return '' }
5 for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var
6 switch (path.charCodeAt(i)) {
7 case 0x2F: // '/'
8 case 0x5C: // '\'
9 path = path.slice(i + 1)
10 return (path === '..' || path === '.' ? '' : path)
11 }
12 }
13 return (path === '..' || path === '.' ? '' : path)
14}
Note: See TracBrowser for help on using the repository browser.