From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/glob-parent/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 node_modules/glob-parent/index.js (limited to 'node_modules/glob-parent/index.js') diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js new file mode 100644 index 0000000..3a14a53 --- /dev/null +++ b/node_modules/glob-parent/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var path = require('path'); +var isglob = require('is-glob'); +var pathDirname = require('path-dirname'); +var isWin32 = require('os').platform() === 'win32'; + +module.exports = function globParent(str) { + // flip windows path separators + if (isWin32 && str.indexOf('/') < 0) str = str.split('\\').join('/'); + + // special case for strings ending in enclosure containing path separator + if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/'; + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do {str = pathDirname.posix(str)} + while (isglob(str) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str)); + + // remove escape chars and return result + return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1'); +}; -- cgit v1.2.3