sloc-count
This module is a very, very simple way to count the number of source lines as well as single line and block comments.
This module could probably use some sophistication.
Install
npm install sloc-count
Usage
sloc-count(contents, [options, callback])
Options:
lineSeparator
: The line separator (defaults to/r/n
)singleLineComment
: The identifier for a single line comment (defaults to//
)blockCommentOpen
: The identifier for the block comment open (defaults to/*
)blockCommentClose
: The identifier for the block comment close (defaullts to*/
)
If the callback
is omitted, the method returns the statistics.
Example
Also see the example in the examples
directory.
var slocCounter = ; // Read a file from diskvar contents = ; // Now put them through the counter;
Changelog
- 0.0.5 - 7 December 2015
- Improved default options handling
- 0.0.1 - 0.0.4 - 1 December 2015
- (0.0.4) Added mocha tests
- (0.0.3) Added support for several
options
- (0.0.2) Omitting a callback now returns the result directly
- (0.0.1) Initial publish
License
Copyright 2015 Michiel van der Velde.
This software is licensed under the MIT License.