/usr/lib/nodejs/glob-parent/index.js is in node-glob-parent 3.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 'use strict';
var path = require('path');
var isglob = require('is-glob');
module.exports = function globParent(str) {
// 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 = path.dirname(str)}
while (isglob(str) || /(^|[^\\])[\{\[]/.test(str));
// remove escape chars and return result
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
};
|