Bakhtina Sofya b84cb877be 1st comm | 2 semanas atrás | |
---|---|---|
.. | ||
index.d.ts | 2 semanas atrás | |
index.js | 2 semanas atrás | |
license | 2 semanas atrás | |
package.json | 2 semanas atrás | |
readme.md | 2 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