react-side-effect
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -95,3 +95,3 @@ import React, { Component } from 'react'; | ||
_proto.componentWillMount = function componentWillMount() { | ||
_proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
mountedInstances.push(this); | ||
@@ -98,0 +98,0 @@ emitChange(); |
@@ -100,3 +100,3 @@ 'use strict'; | ||
_proto.componentWillMount = function componentWillMount() { | ||
_proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
mountedInstances.push(this); | ||
@@ -103,0 +103,0 @@ emitChange(); |
@@ -30,51 +30,47 @@ (function (global, factory) { | ||
// | ||
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) { | ||
var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | ||
var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | ||
if (ret !== void 0) { | ||
return !!ret; | ||
} | ||
if(ret !== void 0) { | ||
return !!ret; | ||
} | ||
if (objA === objB) { | ||
return true; | ||
} | ||
if(objA === objB) { | ||
return true; | ||
} | ||
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { | ||
return false; | ||
} | ||
if(typeof objA !== 'object' || !objA || | ||
typeof objB !== 'object' || !objB) { | ||
return false; | ||
} | ||
var keysA = Object.keys(objA); | ||
var keysB = Object.keys(objB); | ||
var keysA = Object.keys(objA); | ||
var keysB = Object.keys(objB); | ||
if (keysA.length !== keysB.length) { | ||
return false; | ||
} | ||
if(keysA.length !== keysB.length) { | ||
return false; | ||
} | ||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | ||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | ||
// Test for A's keys different from B. | ||
for (var idx = 0; idx < keysA.length; idx++) { | ||
var key = keysA[idx]; | ||
// Test for A's keys different from B. | ||
for(var idx = 0; idx < keysA.length; idx++) { | ||
if (!bHasOwnProperty(key)) { | ||
return false; | ||
} | ||
var key = keysA[idx]; | ||
var valueA = objA[key]; | ||
var valueB = objB[key]; | ||
if(!bHasOwnProperty(key)) { | ||
return false; | ||
} | ||
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | ||
var valueA = objA[key]; | ||
var valueB = objB[key]; | ||
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | ||
if(ret === false || | ||
ret === void 0 && valueA !== valueB) { | ||
return false; | ||
} | ||
if (ret === false || (ret === void 0 && valueA !== valueB)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
return true; | ||
}; | ||
@@ -152,3 +148,3 @@ | ||
_proto.componentWillMount = function componentWillMount() { | ||
_proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
mountedInstances.push(this); | ||
@@ -155,0 +151,0 @@ emitChange(); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).withSideEffect=t(e.React)}(this,function(e){"use strict";var t="default"in e?e.default:e;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),u=Object.keys(t);if(i.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),f=0;f<i.length;f++){var a=i[f];if(!c(a))return!1;var p=e[a],d=t[a];if(!1===(o=n?n.call(r,p,d,a):void 0)||void 0===o&&p!==d)return!1}return!0},o=!("undefined"==typeof window||!window.document||!window.document.createElement);return function(i,u,c){if("function"!=typeof i)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof u)throw new Error("Expected handleStateChangeOnClient to be a function.");if(void 0!==c&&"function"!=typeof c)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(f){if("function"!=typeof f)throw new Error("Expected WrappedComponent to be a React component.");var a,p=[];function d(){a=i(p.map(function(e){return e.props})),l.canUseDOM?u(a):c&&(a=c(a))}var l=function(e){var n,o;function i(){return e.apply(this,arguments)||this}o=e,(n=i).prototype=Object.create(o.prototype),n.prototype.constructor=n,n.__proto__=o,i.peek=function(){return a},i.rewind=function(){if(i.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var e=a;return a=void 0,p=[],e};var u=i.prototype;return u.shouldComponentUpdate=function(e){return!r(e,this.props)},u.componentWillMount=function(){p.push(this),d()},u.componentDidUpdate=function(){d()},u.componentWillUnmount=function(){var e=p.indexOf(this);p.splice(e,1),d()},u.render=function(){return t.createElement(f,this.props)},i}(e.Component);return n(l,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(f)+")"),n(l,"canUseDOM",o),l}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).withSideEffect=t(e.React)}(this,function(e){"use strict";var t="default"in e?e.default:e;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),u=Object.keys(t);if(i.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),f=0;f<i.length;f++){var a=i[f];if(!c(a))return!1;var p=e[a],d=t[a];if(!1===(o=n?n.call(r,p,d,a):void 0)||void 0===o&&p!==d)return!1}return!0},o=!("undefined"==typeof window||!window.document||!window.document.createElement);return function(i,u,c){if("function"!=typeof i)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof u)throw new Error("Expected handleStateChangeOnClient to be a function.");if(void 0!==c&&"function"!=typeof c)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(f){if("function"!=typeof f)throw new Error("Expected WrappedComponent to be a React component.");var a,p=[];function d(){a=i(p.map(function(e){return e.props})),l.canUseDOM?u(a):c&&(a=c(a))}var l=function(e){var n,o;function i(){return e.apply(this,arguments)||this}o=e,(n=i).prototype=Object.create(o.prototype),n.prototype.constructor=n,n.__proto__=o,i.peek=function(){return a},i.rewind=function(){if(i.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var e=a;return a=void 0,p=[],e};var u=i.prototype;return u.shouldComponentUpdate=function(e){return!r(e,this.props)},u.UNSAFE_componentWillMount=function(){p.push(this),d()},u.componentDidUpdate=function(){d()},u.componentWillUnmount=function(){var e=p.indexOf(this);p.splice(e,1),d()},u.render=function(){return t.createElement(f,this.props)},i}(e.Component);return n(l,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(f)+")"),n(l,"canUseDOM",o),l}}}); |
{ | ||
"name": "react-side-effect", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Create components whose prop changes map to a global side effect", | ||
@@ -34,3 +34,3 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0" | ||
"react": "^16.9.0" | ||
}, | ||
@@ -51,3 +51,5 @@ "dependencies": { | ||
"chai": "^3.2.0", | ||
"enzyme": "^2.7.0", | ||
"create-react-class": "^15.6.3", | ||
"enzyme": "^3.10.0", | ||
"enzyme-adapter-react-16": "^1.14.0", | ||
"gzip-size": "^4.1.0", | ||
@@ -58,5 +60,4 @@ "isparta": "^4.0.0", | ||
"pretty-bytes": "^4.0.2", | ||
"react": "^15.4.2", | ||
"react-addons-test-utils": "^15.4.2", | ||
"react-dom": "^15.4.2", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"rimraf": "^2.4.3", | ||
@@ -63,0 +64,0 @@ "rollup": "^1.20.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22757
26
344