1 |
|
2 |
|
3 | var dateFormat = require('dateformat')
|
4 | var semverRegex = require('semver-regex')
|
5 |
|
6 | function 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 |
|
18 | module.exports = transform
|