Use includes instead of indexOf

This commit is contained in:
Maximilian Krög
2022-08-05 00:36:16 +02:00
parent 5e34b9aa20
commit 0b945f2321
26 changed files with 50 additions and 57 deletions

View File

@@ -79,7 +79,7 @@
<?js if (doc.kind == 'class') {
var subclasses = self.find(function() {
return this.augments && this.augments.indexOf(doc.longname) > -1;
return this.augments && this.augments.includes(doc.longname);
})
if (subclasses.length) {
?>

View File

@@ -6,7 +6,7 @@
<p class="code-caption"><?js= example.caption ?></p>
<?js } ?>
<?js if (example.code.toString().indexOf('<pre>') === -1) { ?>
<?js if (!example.code.toString().includes('<pre>')) { ?>
<pre class="prettyprint"><code><?js= example.code ?></code></pre>
<?js } else { ?>
<?js= example.code.replace(/<pre>/g, '<pre class="prettyprint">') ?>

View File

@@ -23,7 +23,7 @@
var colspan = 2;
params.forEach(function(param) {
if (!param) { return; }
if (param.type && param.type.names && param.type.names.indexOf('undefined') !== -1) {
if (param.type && param.type.names && param.type.names.includes('undefined')) {
param.optional = true;
}
if (param.name.indexOf('var_') == 0) {
@@ -70,7 +70,7 @@
<?js if (!param.subparams) {?>
<td class="type">
<?js if (param.type && param.type.names) {?>
<?js= self.partial('type.tmpl', param.type.names) + (param.optional && typeof param.defaultvalue === 'undefined' && param.type.names.indexOf('undefined') === -1 ? ' | undefined' : '') ?>
<?js= self.partial('type.tmpl', param.type.names) + (param.optional && typeof param.defaultvalue === 'undefined' && !param.type.names.includes('undefined') ? ' | undefined' : '') ?>
<?js if (typeof param.defaultvalue !== 'undefined') { ?>
(defaults to <?js= self.htmlsafe(param.defaultvalue) ?>)
<?js } ?>