Skip to content

Commit

Permalink
do not mutate the value keys
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-decker committed Jun 1, 2016
1 parent 635ce80 commit 01bf595
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/isomorphic/classic/types/checkReactTypeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var loggedTypeFailures = {};
* @private
*/
function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
const mismatched = Object.keys(values).filter(x => Object.keys(typeSpecs).indexOf(x) === -1)
.map(i => i.toLowerCase());
const mismatched = Object.keys(values).filter(x => Object.keys(typeSpecs).indexOf(x) === -1);
const lowercase = mismatched.map(i => i.toLowerCase());
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
Expand Down Expand Up @@ -88,8 +88,8 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
componentStackInfo
);
}
if (mismatched.indexOf(typeSpecName.toLowerCase()) !== -1) {
const mismatch = mismatched[mismatched.indexOf(typeSpecName.toLowerCase())];
if (lowercase.indexOf(typeSpecName.toLowerCase()) !== -1) {
const mismatch = mismatched[lowercase.indexOf(typeSpecName.toLowerCase())];
warning(
false,
'Provided prop %s is not defined in propTypes, did you mean %s?',
Expand Down

0 comments on commit 01bf595

Please sign in to comment.