aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/utils.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-25 17:51:38 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-25 17:51:38 -0700
commit817b675c5296d25a1fc41d9c3e68effbcee31100 (patch)
tree5940b85167156d5a116046b04ef173591bd0ae6d /web/src/js/utils.js
parentffe6593361670a5963d2e07ed6ac2d5f022a66e7 (diff)
parent3ebb58f641612a4c512c045187ffe40879720fa7 (diff)
downloadmitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.tar.gz
mitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.tar.bz2
mitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.zip
Merge branch 'flow_editing_v2'
Diffstat (limited to 'web/src/js/utils.js')
-rw-r--r--web/src/js/utils.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/web/src/js/utils.js b/web/src/js/utils.js
index eecacfbb..e44182d0 100644
--- a/web/src/js/utils.js
+++ b/web/src/js/utils.js
@@ -108,11 +108,22 @@ fetchApi.put = (url, json, options) => fetchApi(
}
)
+export function getDiff(obj1, obj2) {
+ let result = {...obj2};
+ for(let key in obj1) {
+ if(_.isEqual(obj2[key], obj1[key]))
+ result[key] = undefined
+ else if(!(Array.isArray(obj2[key]) && Array.isArray(obj1[key])) &&
+ typeof obj2[key] == 'object' && typeof obj1[key] == 'object')
+ result[key] = getDiff(obj1[key], obj2[key])
+ }
+ return result
+}
+
export const pure = renderFn => class extends React.Component {
static displayName = renderFn.name
shouldComponentUpdate(nextProps) {
- console.log(!shallowEqual(this.props, nextProps))
return !shallowEqual(this.props, nextProps)
}