From 0469abd4a9c9270a1fdc962969e36e63699af8b4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 10 Dec 2017 21:51:33 +0100 Subject: upgrade dependencies --- node_modules/nanomatch/lib/utils.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'node_modules/nanomatch/lib/utils.js') diff --git a/node_modules/nanomatch/lib/utils.js b/node_modules/nanomatch/lib/utils.js index 962523be7..6fc434012 100644 --- a/node_modules/nanomatch/lib/utils.js +++ b/node_modules/nanomatch/lib/utils.js @@ -15,6 +15,14 @@ utils.pick = require('object.pick'); utils.typeOf = require('kind-of'); utils.unique = require('array-unique'); +/** + * Returns true if the given value is effectively an empty string + */ + +utils.isEmptyString = function(val) { + return String(val) === '' || String(val) === './'; +}; + /** * Returns true if the platform is windows, or `path.sep` is `\\`. * This is defined as a function to allow `path.sep` to be set in unit tests, @@ -204,11 +212,7 @@ utils.stripDrive = function(fp) { */ utils.stripPrefix = function(str) { - if (str.charAt(0) !== '.') { - return str; - } - var ch = str.charAt(1); - if (utils.isSlash(ch)) { + if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) { return str.slice(2); } return str; @@ -342,6 +346,9 @@ utils.value = function(str, unixify, options) { if (options && options.unixify === false) { return str; } + if (options && typeof options.unixify === 'function') { + return options.unixify(str); + } return unixify(str); }; @@ -353,17 +360,17 @@ utils.value = function(str, unixify, options) { */ utils.unixify = function(options) { - options = options || {}; + var opts = options || {}; return function(filepath) { - if (utils.isWindows() || options.unixify === true) { - filepath = utils.toPosixPath(filepath); - } - if (options.stripPrefix !== false) { + if (opts.stripPrefix !== false) { filepath = utils.stripPrefix(filepath); } - if (options.unescape === true) { + if (opts.unescape === true) { filepath = utils.unescape(filepath); } + if (opts.unixify === true || utils.isWindows()) { + filepath = utils.toPosixPath(filepath); + } return filepath; }; }; -- cgit v1.2.3