shebang-command
Advanced tools
Comparing version 1.2.0 to 2.0.0
20
index.js
'use strict'; | ||
var shebangRegex = require('shebang-regex'); | ||
const shebangRegex = require('shebang-regex'); | ||
module.exports = function (str) { | ||
var match = str.match(shebangRegex); | ||
module.exports = (string = '') => { | ||
const match = string.match(shebangRegex); | ||
@@ -11,10 +11,10 @@ if (!match) { | ||
var arr = match[0].replace(/#! ?/, '').split(' '); | ||
var bin = arr[0].split('/').pop(); | ||
var arg = arr[1]; | ||
const [path, argument] = match[0].replace(/#! ?/, '').split(' '); | ||
const binary = path.split('/').pop(); | ||
return (bin === 'env' ? | ||
arg : | ||
bin + (arg ? ' ' + arg : '') | ||
); | ||
if (binary === 'env') { | ||
return argument; | ||
} | ||
return argument ? `${binary} ${argument}` : binary; | ||
}; |
{ | ||
"name": "shebang-command", | ||
"version": "1.2.0", | ||
"description": "Get the command from a shebang", | ||
"license": "MIT", | ||
"repository": "kevva/shebang-command", | ||
"author": { | ||
"name": "Kevin Martensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"cmd", | ||
"command", | ||
"parse", | ||
"shebang" | ||
], | ||
"dependencies": { | ||
"shebang-regex": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"ignores": [ | ||
"test.js" | ||
] | ||
} | ||
"name": "shebang-command", | ||
"version": "2.0.0", | ||
"description": "Get the command from a shebang", | ||
"license": "MIT", | ||
"repository": "kevva/shebang-command", | ||
"author": { | ||
"name": "Kevin Mårtensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "github.com/kevva" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"cmd", | ||
"command", | ||
"parse", | ||
"shebang" | ||
], | ||
"dependencies": { | ||
"shebang-regex": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.3.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) | ||
``` | ||
$ npm install --save shebang-command | ||
$ npm install shebang-command | ||
``` | ||
@@ -36,6 +36,1 @@ | ||
String containing a shebang. | ||
## License | ||
MIT © [Kevin Martensson](http://github.com/kevva) |
Sorry, the diff of this file is not supported yet
2556
14
35
+ Addedshebang-regex@3.0.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
Updatedshebang-regex@^3.0.0