source: imaps-frontend/node_modules/shebang-command/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 387 bytes
RevLine 
[d565449]1'use strict';
2const shebangRegex = require('shebang-regex');
3
4module.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.