Fixed bug allowing versions of Object.keys method and hard coding of ownProps array (#35021)
* fix: disallow variants of Object.keys method * fix: added new test to help prevent hardcoding array * fix: refactored regexpull/30387/head^2
parent
15a8e35288
commit
9051ad2eb5
|
@ -25,9 +25,11 @@ Add the <code>own</code> properties of <code>canary</code> to the array <code>ow
|
|||
```yml
|
||||
tests:
|
||||
- text: <code>ownProps</code> should include the values <code>"numLegs"</code> and <code>"name"</code>.
|
||||
testString: assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1, '<code>ownProps</code> should include the values <code>"numLegs"</code> and <code>"name"</code>.');
|
||||
testString: assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1);
|
||||
- text: Solve this challenge without using the built in method <code>Object.keys()</code>.
|
||||
testString: assert(!/\Object.keys/.test(code), 'Solve this challenge without using the built in method <code>Object.keys()</code>.');
|
||||
testString: assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code));
|
||||
- text: Solve this challenge without hardcoding the <code>ownProps</code> array.
|
||||
testString: assert(!/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test(code));
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue