|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
387 bytes
|
| Line | |
|---|
| 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 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.