summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2018-03-21 15:37:12 +0100
committerTobias Nießen <tniessen@tnie.de>2018-03-25 03:35:31 +0200
commit337e04054eedb3cedb27493adb02ca84d2c75005 (patch)
tree19d10b0f304c0e661a0b2f81c7f1527630d2cade /tools
parent5b9f8e1d7718a6e9f8ba21848173fe864d3e77f4 (diff)
downloadandroid-node-v8-337e04054eedb3cedb27493adb02ca84d2c75005.tar.gz
android-node-v8-337e04054eedb3cedb27493adb02ca84d2c75005.tar.bz2
android-node-v8-337e04054eedb3cedb27493adb02ca84d2c75005.zip
tools: shorten metadata parsing
PR-URL: https://github.com/nodejs/node/pull/19512 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/common.js19
1 files changed, 8 insertions, 11 deletions
diff --git a/tools/doc/common.js b/tools/doc/common.js
index 9f7a25ecd4..3a66cbd7b0 100644
--- a/tools/doc/common.js
+++ b/tools/doc/common.js
@@ -13,31 +13,28 @@ function arrify(value) {
}
function extractAndParseYAML(text) {
- text = text.trim();
-
- text = text.replace(/^<!-- YAML/, '')
+ text = text.trim()
+ .replace(/^<!-- YAML/, '')
.replace(/-->$/, '');
// js-yaml.safeLoad() throws on error
const meta = yaml.safeLoad(text);
- const added = meta.added;
- if (added) {
+ if (meta.added) {
// Since semver-minors can trickle down to previous major versions,
// features may have been added in multiple versions.
- meta.added = arrify(added);
+ meta.added = arrify(meta.added);
}
- const deprecated = meta.deprecated;
- if (deprecated) {
+ if (meta.deprecated) {
// Treat deprecated like added for consistency.
- meta.deprecated = arrify(deprecated);
+ meta.deprecated = arrify(meta.deprecated);
}
meta.changes = meta.changes || [];
- meta.changes.forEach((entry) => {
+ for (const entry of meta.changes) {
entry.description = entry.description.replace(/^\^\s*/, '');
- });
+ }
return meta;
}