wallet-core/node_modules/glob-parent/index.js

12 lines
350 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
'use strict';
var path = require('path');
var isglob = require('is-glob');
2016-11-03 01:33:53 +01:00
var pathDirname = require('path-dirname');
2016-10-10 03:43:44 +02:00
module.exports = function globParent(str) {
str += 'a'; // preserves full path in case of trailing path separator
2016-11-03 01:33:53 +01:00
do {str = pathDirname.posix(str)} while (isglob(str));
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
2016-10-10 03:43:44 +02:00
};