Bakhtina Sofya 441b76b729 first commit | há 3 semanas atrás | |
---|---|---|
.. | ||
index.d.ts | há 3 semanas atrás | |
index.js | há 3 semanas atrás | |
license | há 3 semanas atrás | |
package.json | há 3 semanas atrás | |
readme.md | há 3 semanas atrás |
Regular expression for matching a shebang line
$ npm install shebang-regex
const shebangRegex = require('shebang-regex');
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
shebangRegex.test(string);
//=> true
shebangRegex.exec(string)[0];
//=> '#!/usr/bin/env node'
shebangRegex.exec(string)[1];
//=> '/usr/bin/env node'
MIT © Sindre Sorhus