Dailin 415ba84223 | 3 anos atrás | ||
---|---|---|---|
.. | |||
index.d.ts | 3 anos atrás | ||
index.js | 3 anos atrás | ||
license | 3 anos atrás | ||
package.json | 3 anos atrás | ||
readme.md | 3 anos 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