CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-uglify-save-license

License detector for UglifyJS that identifies and preserves license comments during minification

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-1/

Comment Type Analyzer

Build a function that analyzes JavaScript comment tokens and categorizes them by type, distinguishing between line comments and block comments.

Capabilities

Comment Type Detection

Your function should process comment objects and determine whether they represent line comments or block comments based on their type field.

  • Given a comment object with type: 'comment1' and value: ' This is a line comment', the function returns 'line' @test
  • Given a comment object with type: 'comment2' and value: ' This is a block comment ', the function returns 'block' @test
  • Given a comment object with type: 'comment1' and value: ' TODO: refactor this', the function returns 'line' @test
  • Given a comment object with type: 'comment2' and value: '! Important notice ', the function returns 'block' @test

Implementation

@generates

API

/**
 * 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;

Dependencies { .dependencies }

uglify-save-license { .dependency }

Provides comment analysis support for JavaScript minification tools.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-uglify-save-license

tile.json