License detector for UglifyJS that identifies and preserves license comments during minification
Overall
score
98%
Build a function that analyzes JavaScript comment tokens and categorizes them by type, distinguishing between line comments and block comments.
Your function should process comment objects and determine whether they represent line comments or block comments based on their type field.
type: 'comment1' and value: ' This is a line comment', the function returns 'line' @testtype: 'comment2' and value: ' This is a block comment ', the function returns 'block' @testtype: 'comment1' and value: ' TODO: refactor this', the function returns 'line' @testtype: 'comment2' and value: '! Important notice ', the function returns 'block' @test@generates
/**
* Detects and returns the type of a JavaScript comment
* @param {Object} comment - Comment token with the following properties:
* @param {string} comment.type - Comment type ('comment1' for line, 'comment2' for block)
* @param {string} comment.value - Content of the comment
* @returns {string} - Returns 'line' for line comments, 'block' for block comments
*/
function detectCommentType(comment) {
// Implementation here
}
module.exports = detectCommentType;Provides comment analysis support for JavaScript minification tools.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-uglify-save-licensedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10