Comparing version 0.0.0 to 0.0.1
16
index.js
@@ -1,20 +0,4 @@ | ||
var transformCode = require('./src/transform'); | ||
/** | ||
* Create metalsmith plugin function. | ||
* | ||
* @return {Function} metalsmith plugin | ||
*/ | ||
module.exports = function() { | ||
return function(files, metalsmith, done) { | ||
for (var path in files) { | ||
files[path].docrope = transformCode(files[path].contents.toString('utf8')); | ||
} | ||
done(); | ||
} | ||
}; | ||
/** | ||
* Parse JavaScript code and return doc comments data. | ||
@@ -21,0 +5,0 @@ * |
{ | ||
"name": "docrope", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Extremely simple JavaScript document generator.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,4 +13,5 @@ Docrope | ||
var docrope = require('docrope'); | ||
var fs = require('fs'); | ||
console.log(docrope('./hoge.js')); | ||
console.log(docrope.parse(fs.readFileSync('./hoge.js'))); | ||
``` | ||
@@ -17,0 +18,0 @@ |
@@ -41,3 +41,3 @@ var esprima = require('esprima'); | ||
var comments = result.comments | ||
var comments = (result.comments || []) | ||
.filter(function(comment) { | ||
@@ -44,0 +44,0 @@ return comment.value.substr(0, 1) === '*'; |
@@ -7,6 +7,2 @@ var expect = require('chai').expect; | ||
describe('docrope', function() { | ||
it('should provide parse function and metalsmith plugin', function() { | ||
expect(docrope()).is.a('function'); | ||
expect(docrope.parse).is.a('function'); | ||
}); | ||
@@ -18,2 +14,7 @@ describe('docrope()', function() { | ||
describe('parse()', function() { | ||
it('should parse empty string', function() { | ||
var result = parse(''); | ||
expect(!!result.docComments).is.equal(true); | ||
}); | ||
it('should parse testcase-01.js', function() { | ||
@@ -20,0 +21,0 @@ var code = fs.readFileSync(__dirname + '/fixture/testcase-01.js'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30
5535
142