indexOf() instead of includes()

This commit is contained in:
quentin
2017-02-20 15:42:50 -05:00
parent 5658256715
commit de707c185e
4 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@ const transformersForHtmlJS = {
name: 'add-loop-protect',
transformer: function addLoopProtect(file) {
const _contents = file.contents.toLowerCase();
if (file.ext === 'html' && !_contents.includes('<script>')) {
if (file.ext === 'html' && _contents.indexOf('<script>') === -1) {
// No JavaScript in user code, so no need for loopProtect
return updateContents(file.contents, file);
}

View File

@ -28,7 +28,7 @@ export default function blockNameify(phrase) {
}
return phrase.split('-')
.map((word) => {
if (noFormatting.includes(word)) {
if (noFormatting.indexOf(word) !== -1) {
return word;
}
if (word === 'javascript') {

View File

@ -334,7 +334,7 @@
""
],
"tests": [
"assert(ownProps.includes('name') && ownProps.includes('numLegs'), 'message: <code>ownProps</code> should include the values <code>\"numLegs\"</code> and <code>\"name\"</code>.');",
"assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1, 'message: <code>ownProps</code> should include the values <code>\"numLegs\"</code> and <code>\"name\"</code>.');",
"assert(!/\\Object.keys/.test(code), 'message: Solve this challenge without using the built in method <code>Object.keys()</code>.');"
],
"solutions": [
@ -414,8 +414,8 @@
""
],
"tests": [
"assert(ownProps.includes('name'), 'message: The <code>ownProps</code> array should include <code>\"name\"</code>.');",
"assert(prototypeProps.includes('numLegs'), 'message: The <code>prototypeProps</code> array should include <code>\"numLegs\"</code>.');",
"assert(ownProps.indexOf('name') !== -1, 'message: The <code>ownProps</code> array should include <code>\"name\"</code>.');",
"assert(prototypeProps.indexOf('numLegs') !== -1, 'message: The <code>prototypeProps</code> array should include <code>\"numLegs\"</code>.');",
"assert(!/\\Object.keys/.test(code), 'message: Solve this challenge without using the built in method <code>Object.keys()</code>.');"
],
"solutions": [

View File

@ -2579,9 +2579,9 @@
],
"tests": [
"assert(Object.keys(undirectedAdjList).length === 4, 'message: <code>undirectedAdjList</code> should only contain four nodes.');",
"assert(undirectedAdjList.James.includes(\"Jeff\") && undirectedAdjList.Jeff.includes(\"James\"), 'message: There should be an edge between <code>Jeff</code> and <code>James</code>.');",
"assert(undirectedAdjList.Jill.includes(\"Jenny\") && undirectedAdjList.Jill.includes(\"Jenny\"), 'message: There should be an edge between <code>Jill</code> and <code>Jenny</code>.');",
"assert(undirectedAdjList.Jeff.includes(\"Jenny\") && undirectedAdjList.Jenny.includes(\"Jeff\"), 'message: There should be an edge between <code>Jeff</code> and <code>Jenny</code>.');"
"assert(undirectedAdjList.James.indexOf(\"Jeff\") !== -1 && undirectedAdjList.Jeff.indexOf(\"James\") !== -1, 'message: There should be an edge between <code>Jeff</code> and <code>James</code>.');",
"assert(undirectedAdjList.Jill.indexOf(\"Jenny\") !== -1 && undirectedAdjList.Jill.indexOf(\"Jenny\") !== -1, 'message: There should be an edge between <code>Jill</code> and <code>Jenny</code>.');",
"assert(undirectedAdjList.Jeff.indexOf(\"Jenny\") !== -1 && undirectedAdjList.Jenny.indexOf(\"Jeff\") !== -1, 'message: There should be an edge between <code>Jeff</code> and <code>Jenny</code>.');"
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",