JavaScript comments library, help you to create a variety of comment-String.Single-line, block comments.HTML,CSS,Javascript comments.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
browser
test
wrapper
LICENSE
README.md
build.js
ciment.js
package.json

README.md

ciment

ciment is a library for generating comment-String rapidly. Include javascript, CSS and HTML commnets manipulation.

// In nodejs
var comment = require('ciment');

// Comment module methods
comment.single('hello world'); // result: "// hello world"
comment.block('hello world'); // result: "/* hello world */"

// Prototype module methods
'hello world'.single(); // result: "// hello world"
'hello world'.block(); // result: "/* hello world */"

'hello world'.block().decomment(); // result: "hello world"

Install

npm

For node with npm:

npm install ciment

And use with var ciment = require("ciment")

browser

<script src="browser/ciment.script.js"></script>
<script>
  var ciment = window.ciment,
      commentStr = 'Hello world';

  commentStr = commentStr.title(); // '/*****  Hello world  *****/'
  commentStr = ciment.decomment(commentStr); // 'Hello world'
</script>

Use with CMD:

define(function (require,exports,module) {
  var ciment = require('ciment.cmd');
  var banner = 'Hello world\nI am ciment'.banner();
});

API

Base function

comment.decomment(content);

Remove the first wrapper comment form this string

Module function

comment.single("comment text");
//  comment text

Return a single line comment string

comment.block("comment text");
/*  comment text  */

Return a normal block comment string

comment.title("comment text");
/*****  comment text  *****/

Return a block comment string like comment title

comment.banner("comment text\nhello world");
/**
*    comment text
*    hello world
**/

Return a banner block comment string

comment.tag("<div>comment text</div>");
<!-- <div>comment text</div> -->

Return a html tag comment string

Prototype function

"comment text".single();
//  comment text
"comment text".block();
/*  comment text  */
"comment text".title();
/*****  comment text  *****/
"comment text".banner();
/**
*    comment text
*    hello world
**/
"<div>comment text</div>".tag();
<!-- <div>comment text</div> -->