0.1.1 • Published 10 years ago
attribution v0.1.1
attribution
Explain your JavaScript
install
npm install attributionusage
Parsing JavaScript
var parse = require('attribution');
var src = fs.readSync('some-js-file.js');
var attributes = parse(src);
console.log(attributes); // => array of AttributeGulp
var wrap = require('gulp-wrap');
var attribution = require('gulp-attribution');
gulp.task('js', function() {
gulp.src('src/*.js')
.pipe(attribution())
.pipe(wrap('// this is the <%= file.attributes.name %> module'))
.pipe(gulp.dest('dist'));
});API
parse(src)
Arguments
src- ABufferorStringof JavaScript
Returns
An Array of Attribute objects.
Attribute
Properties
name- the name of the attribute (eg.@foo => 'foo')value- the first value provided (eg.@foo bar => 'bar')line- the lineNumberof the attribute within the JavaScript source