This commit is contained in:
2026-05-15 08:32:45 +02:00
parent fc2547bd59
commit 231006e61d
2143 changed files with 0 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
'use strict';
const shebangRegex = require('shebang-regex');
module.exports = (string = '') => {
const match = string.match(shebangRegex);
if (!match) {
return null;
}
const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
const binary = path.split('/').pop();
if (binary === 'env') {
return argument;
}
return argument ? `${binary} ${argument}` : binary;
};