removed unnecessary function in equals.js
This commit is contained in:
parent
e2312d954d
commit
c4d6fd91db
|
@ -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';
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue