lint: json.js

pull/4698/head
John McLear 2021-02-01 23:11:11 +00:00 committed by Richard Hansen
parent 05e0e8dbf7
commit 65dec5bd2c
1 changed files with 10 additions and 9 deletions

View File

@ -248,11 +248,11 @@ const processList = (section) => {
switch (section.type) { switch (section.type) {
case 'ctor': case 'ctor':
case 'classMethod': case 'classMethod':
case 'method': case 'method': {
// each item is an argument, unless the name is 'return', // each item is an argument, unless the name is 'return',
// in which case it's the return value. // in which case it's the return value.
section.signatures = section.signatures || []; section.signatures = section.signatures || [];
var sig = {}; const sig = {};
section.signatures.push(sig); section.signatures.push(sig);
sig.params = values.filter((v) => { sig.params = values.filter((v) => {
if (v.name === 'return') { if (v.name === 'return') {
@ -263,11 +263,11 @@ const processList = (section) => {
}); });
parseSignature(section.textRaw, sig); parseSignature(section.textRaw, sig);
break; break;
}
case 'property': case 'property': {
// there should be only one item, which is the value. // there should be only one item, which is the value.
// copy the data up to the section. // copy the data up to the section.
var value = values[0] || {}; const value = values[0] || {};
delete value.name; delete value.name;
section.typeof = value.type; section.typeof = value.type;
delete value.type; delete value.type;
@ -275,14 +275,15 @@ const processList = (section) => {
section[k] = value[k]; section[k] = value[k];
}); });
break; break;
}
case 'event': case 'event': {
// event: each item is an argument. // event: each item is an argument.
section.params = values; section.params = values;
break; break;
} }
}
// section.listParsed = values;
delete section.list; delete section.list;
}; };
@ -417,7 +418,7 @@ const finishSection = (section, parent) => {
ctor.signatures.forEach((sig) => { ctor.signatures.forEach((sig) => {
sig.desc = ctor.desc; sig.desc = ctor.desc;
}); });
sigs.push.apply(sigs, ctor.signatures); sigs.push(...ctor.signatures);
}); });
delete section.ctors; delete section.ctors;
} }
@ -486,7 +487,7 @@ const finishSection = (section, parent) => {
// Not a general purpose deep copy. // Not a general purpose deep copy.
// But sufficient for these basic things. // But sufficient for these basic things.
const deepCopy = (src, dest) => { const deepCopy = (src, dest) => {
Object.keys(src).filter((k) => !dest.hasOwnProperty(k)).forEach((k) => { Object.keys(src).filter((k) => !Object.prototype.hasOwnProperty.call(dest, k)).forEach((k) => {
dest[k] = deepCopy_(src[k]); dest[k] = deepCopy_(src[k]);
}); });
}; };