removed unnecessary function in equals.js

This commit is contained in:
dherrero 2017-10-05 09:51:27 +02:00
parent e2312d954d
commit c4d6fd91db
2 changed files with 2 additions and 43 deletions

View File

@ -2,47 +2,6 @@ import {module} from '../module';
const isEqual = angular.equals;
export const myEqual = (objA, objB, estrict) => {
let equals = true;
let estrictMode = estrict || true;
if (Object.keys(objA).length !== Object.keys(objB).length) {
return false;
}
for (let k in objA) {
if (!objB.hasOwnProperty(k)) {
return false;
}
if (estrictMode) {
if (typeof objA[k] !== typeof objB[k]) {
return false;
}
if (typeof objA[k] !== 'object' && objA[k] !== objB[k]) {
return false;
}
if (typeof objA[k] === 'object') {
equals = myEqual(objA[k], objB[k], estrictMode);
if (!equals) {
return false;
}
}
} else {
if (typeof objA[k] !== 'object' && objA[k] != objB[k]) {
return false;
}
if (typeof objA[k] === 'object') {
equals = myEqual(objA[k], objB[k], estrictMode);
if (!equals) {
return false;
}
}
}
}
return equals;
};
export default isEqual;
export const NAME = 'equalsObject';

View File

@ -2,7 +2,7 @@ import {module} from '../module';
import Component from '../lib/component';
import getModifiedData from '../lib/modified';
import copyObject from '../lib/copy';
import {myEqual} from '../lib/equals';
import isEqual from '../lib/equals';
/**
* Component that checks for changes on a specific model property and
@ -181,7 +181,7 @@ export default class Watcher extends Component {
dataChanged() {
let newData = this.copyInNewObject(this.data);
return !myEqual(newData, this.orgData);
return !isEqual(newData, this.orgData);
}
onConfirmResponse(response) {