.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / shebang-command / index.js
1 'use strict';
2 const shebangRegex = require('shebang-regex');
3
4 module.exports = (string = '') => {
5         const match = string.match(shebangRegex);
6
7         if (!match) {
8                 return null;
9         }
10
11         const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
12         const binary = path.split('/').pop();
13
14         if (binary === 'env') {
15                 return argument;
16         }
17
18         return argument ? `${binary} ${argument}` : binary;
19 };