Use includes instead of indexOf
This commit is contained in:
@@ -461,7 +461,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
||||
data().each(function (doclet) {
|
||||
const url = helper.longnameToUrl[doclet.longname];
|
||||
|
||||
if (url.indexOf('#') > -1) {
|
||||
if (url.includes('#')) {
|
||||
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
|
||||
} else {
|
||||
doclet.id = doclet.name;
|
||||
|
||||
@@ -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) {
|
||||
?>
|
||||
|
||||
@@ -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">') ?>
|
||||
|
||||
@@ -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 } ?>
|
||||
|
||||
Reference in New Issue
Block a user