diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 08:29:27 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 08:29:27 -1000 |
commit | d96c42c6804052c6ea48b6833b6d8b110d3baad8 (patch) | |
tree | 6c7f7638567a76510759ccd9cebb5dd276490f03 /lib | |
parent | 92f0421665adb2185d90062cf58393742112c5bb (diff) | |
download | patchfoo-d96c42c6804052c6ea48b6833b6d8b110d3baad8.tar.gz patchfoo-d96c42c6804052c6ea48b6833b6d8b110d3baad8.zip |
Hide npm-publish author if it is same as message author
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 4374165..a968702 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -862,6 +862,16 @@ function asNpmReadme(readme) { return u.ifString(readme) } +function singleValue(obj) { + if (!obj || typeof obj !== 'object') return obj + var keys = Object.keys(obj) + if (keys.length === 1) return obj[keys[0]] +} + +function ifDifferent(obj, value) { + if (singleValue(obj) !== value) return obj +} + RenderMsg.prototype.npmPublish = function (cb) { var self = this var render = self.render @@ -898,7 +908,7 @@ RenderMsg.prototype.npmPublish = function (cb) { versions.map(function (version, i) { var release = pkg.versions[version] || {} var license = u.ifString(release.license) - var author = release.author + var author = ifDifferent(release.author, self.msg.value.author) var description = u.ifString(release.description) var readme = asNpmReadme(release.readme) var keywords = u.toArray(release.keywords).map(u.ifString) |