Regular expression for matching Unix shebang lines at the beginning of files
88
A tool that validates script files to ensure they have properly placed shebang lines at the beginning of the file.
true @testfalse @testfalse @testfalse @test@generates
The implementation should export a function isValidShebang that takes a string (representing the content of a script file) and returns a boolean indicating whether the file has a properly positioned shebang line.
A properly positioned shebang line must:
#! character sequence/**
* Validates whether a script file has a properly positioned shebang line.
*
* @param {string} content - The content of the script file to validate.
* @returns {boolean} True if the file has a valid shebang at the beginning, false otherwise.
*/
function isValidShebang(content) {
// IMPLEMENTATION HERE
}
module.exports = { isValidShebang };Provides regular expression for matching Unix shebang lines.
Install with Tessl CLI
npx tessl i tessl/npm-shebang-regexdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9