Bolshakova Anna 3f5a62a82d lab | 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