UNPKG

409 BJavaScriptView Raw
1'use strict';
2
3var dateFormat = require('dateformat');
4var semverRegex = require('semver-regex');
5
6function transform(chunk, cb) {
7 if (typeof chunk.gitTags === 'string') {
8 chunk.version = (chunk.gitTags.match(semverRegex()) || [])[0];
9 }
10
11 if (chunk.committerDate) {
12 chunk.committerDate = dateFormat(chunk.committerDate, 'yyyy-mm-dd', true);
13 }
14
15 cb(null, chunk);
16}
17
18module.exports = transform;