fix(core): update
This commit is contained in:
parent
cd2d162738
commit
5732f0e2cd
4133
package-lock.json
generated
4133
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -13,14 +13,16 @@
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"tslint": "^5.11.0",
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.52",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"@types/node": "^14.14.35",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
],
|
||||
|
@ -9,4 +9,9 @@ tap.test('first test', async () => {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
tap.test('should fast deep equal objects', async () => {
|
||||
expect(smartobject.fastDeepEqual({hello: 'yes'}, {hello: 'yes'})).to.be.true;
|
||||
expect(smartobject.fastDeepEqual({hello: 'yes'}, {hello: 3})).to.be.false;
|
||||
});
|
||||
|
||||
tap.start();
|
11
ts/index.ts
11
ts/index.ts
@ -1,5 +1,10 @@
|
||||
import * as plugins from './smartobject.plugins';
|
||||
|
||||
const fastDeepEqual = plugins.fastDeepEqual;
|
||||
export {
|
||||
fastDeepEqual
|
||||
};
|
||||
|
||||
export interface IObjectCompareResult {
|
||||
presentInBothProperties: string[];
|
||||
missingProperties: string[];
|
||||
@ -60,8 +65,10 @@ export const compareObjects = (referenceObjectArg: any, comparisonObjectArg: any
|
||||
}
|
||||
|
||||
for (const currentProperty of Object.keys(returnComparisonObject)) {
|
||||
const propertySet = new Set(returnComparisonObject[currentProperty]);
|
||||
const uniqueArray = [...propertySet];
|
||||
const onlyUnique = (value, index, self) => {
|
||||
return self.indexOf(value) === index;
|
||||
};
|
||||
const uniqueArray = returnComparisonObject[currentProperty].filter(onlyUnique);
|
||||
returnComparisonObject[currentProperty] = uniqueArray;
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,6 @@
|
||||
const removeme = {};
|
||||
export { removeme };
|
||||
// tslint:disable-next-line: no-submodule-imports
|
||||
import fastDeepEqual from 'fast-deep-equal/es6';
|
||||
|
||||
export {
|
||||
fastDeepEqual
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user