Muqriz 48f16bfc3e initail first | 4 maanden geleden | |
---|---|---|
.. | ||
index.d.ts | 4 maanden geleden | |
index.js | 4 maanden geleden | |
license | 4 maanden geleden | |
package.json | 4 maanden geleden | |
readme.md | 4 maanden geleden |
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