@samitouri / QOS-React-2 / commits / ef2b1f26ef

Unnecessary type comparisons have been changed to value comparison

karczk committed Feb 2, 2016 at 19:35 UTC ef2b1f26efb61ab18eac6919c3e55c46bfa3d385
5 files changed +8 -8
src/addons/link/ReactLink.js
+1 -1
@@ -55,7 +55,7 @@ function ReactLink(value, requestChange) {
55 */
56 function createLinkTypeChecker(linkType) {
57 var shapes = {
58 - value: typeof linkType === 'undefined' ?
58 + value: linkType === undefined ?
59 React.PropTypes.any.isRequired :
60 linkType.isRequired,
61 requestChange: React.PropTypes.func.isRequired,
src/isomorphic/classic/class/ReactClass.js
+1 -1
@@ -777,7 +777,7 @@ var ReactClass = {
777 var initialState = this.getInitialState ? this.getInitialState() : null;
778 if (__DEV__) {
779 // We allow auto-mocks to proceed as if they're returning null.
780 - if (typeof initialState === 'undefined' &&
780 + if (initialState === undefined &&
781 this.getInitialState._isMockFunction) {
782 // This is probably bad practice. Consider warning here and
783 // deprecating this convenience.
src/renderers/dom/client/ReactDOMSelection.js
+2 -2
@@ -138,7 +138,7 @@ function setIEOffsets(node, offsets) {
138 var range = document.selection.createRange().duplicate();
139 var start, end;
140
141 - if (typeof offsets.end === 'undefined') {
141 + if (offsets.end === undefined) {
142 start = offsets.start;
143 end = start;
144 } else if (offsets.start > offsets.end) {
@@ -176,7 +176,7 @@ function setModernOffsets(node, offsets) {
176 var selection = window.getSelection();
177 var length = node[getTextContentAccessor()].length;
178 var start = Math.min(offsets.start, length);
179 - var end = typeof offsets.end === 'undefined' ?
179 + var end = offsets.end === undefined ?
180 start : Math.min(offsets.end, length);
181
182 // IE 11 uses modern selection, but doesn't support the extend method.
src/renderers/dom/client/ReactInputSelection.js
+1 -1
@@ -114,7 +114,7 @@ var ReactInputSelection = {
114 setSelection: function(input, offsets) {
115 var start = offsets.start;
116 var end = offsets.end;
117 - if (typeof end === 'undefined') {
117 + if (end === undefined) {
118 end = start;
119 }
120
src/renderers/shared/reconciler/ReactCompositeComponent.js
+3 -3
@@ -188,7 +188,7 @@ var ReactCompositeComponentMixin = {
188 Component.displayName || Component.name || 'Component';
189
190 warning(
191 - typeof inst.props === 'undefined' || !propsMutated,
191 + inst.props === undefined || !propsMutated,
192 '%s(...): When calling super() in `%s`, make sure to pass ' +
193 'up the same props that your component\'s constructor was passed.',
194 componentName, componentName
@@ -673,7 +673,7 @@ var ReactCompositeComponentMixin = {
673
674 if (__DEV__) {
675 warning(
676 - typeof shouldUpdate !== 'undefined',
676 + shouldUpdate !== undefined,
677 '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
678 'boolean value. Make sure to return true or false.',
679 this.getName() || 'ReactCompositeComponent'
@@ -839,7 +839,7 @@ var ReactCompositeComponentMixin = {
839 var renderedComponent = inst.render();
840 if (__DEV__) {
841 // We allow auto-mocks to proceed as if they're returning null.
842 - if (typeof renderedComponent === 'undefined' &&
842 + if (renderedComponent === undefined &&
843 inst.render._isMockFunction) {
844 // This is probably bad practice. Consider warning here and
845 // deprecating this convenience.