fix: post-increment, pre-decrement working on #76

This commit is contained in:
harttle
2018-07-21 22:59:52 +08:00
parent b5cfd2d2c5
commit c3de3fbb19
12 changed files with 146 additions and 92 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
const resolve = require('resolve-url')
const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/
const urlRe = /^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/
const _ = require('./underscore')
// https://github.com/jinder/path/blob/master/path.js#L567
exports.extname = function (path) {
@@ -16,7 +17,7 @@ exports.resolve = function (root, path) {
if (Object.prototype.toString.call(root) === '[object Array]') {
root = root[0]
}
if (root && root.charAt(root.length - 1) !== '/') {
if (root && _.last(root) !== '/') {
root += '/'
}
return resolve(root, path)