fix(core): update
This commit is contained in:
parent
5944310af9
commit
6c9b19cb9f
@ -19,23 +19,35 @@ mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
audit:
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
@ -50,9 +62,7 @@ testStable:
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -63,9 +73,7 @@ testBuild:
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@ -85,6 +93,8 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,4 @@
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
}
|
@ -4,14 +4,14 @@ import * as smartobject from '../ts/index';
|
||||
tap.test('first test', async () => {
|
||||
const result = smartobject.compareObjects(
|
||||
{ thisIsEq: 'wow', thisIsDeepEq: { deeper: 'sodeep' } },
|
||||
{ thisIsEq: 'wow', thisIsDeepEq: { deeper: 'sodeep' }, hey: 'there' }
|
||||
{ thisIsEq: 'wow', thisIsDeepEq: { deeper: 'sodeep' }, hey: 'there' }
|
||||
);
|
||||
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;
|
||||
expect(smartobject.fastDeepEqual({ hello: 'yes' }, { hello: 'yes' })).to.be.true;
|
||||
expect(smartobject.fastDeepEqual({ hello: 'yes' }, { hello: 3 })).to.be.false;
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
21
ts/index.ts
21
ts/index.ts
@ -1,9 +1,7 @@
|
||||
import * as plugins from './smartobject.plugins';
|
||||
|
||||
const fastDeepEqual = plugins.fastDeepEqual;
|
||||
export {
|
||||
fastDeepEqual
|
||||
};
|
||||
export { fastDeepEqual };
|
||||
|
||||
export interface IObjectCompareResult {
|
||||
presentInBothProperties: string[];
|
||||
@ -15,7 +13,10 @@ export interface IObjectCompareResult {
|
||||
equalProperties: string[];
|
||||
}
|
||||
|
||||
export const compareObjects = (referenceObjectArg: any, comparisonObjectArg: any): IObjectCompareResult => {
|
||||
export const compareObjects = (
|
||||
referenceObjectArg: any,
|
||||
comparisonObjectArg: any
|
||||
): IObjectCompareResult => {
|
||||
const returnComparisonObject = {
|
||||
missingProperties: [],
|
||||
additionalProperties: [],
|
||||
@ -25,7 +26,7 @@ export const compareObjects = (referenceObjectArg: any, comparisonObjectArg: any
|
||||
divergingProperties: [],
|
||||
equalProperties: [],
|
||||
};
|
||||
|
||||
|
||||
const allProperties = Object.keys(referenceObjectArg).concat(Object.keys(comparisonObjectArg));
|
||||
for (const currentProperty of allProperties) {
|
||||
// lets find presentInBothProperties
|
||||
@ -54,12 +55,18 @@ export const compareObjects = (referenceObjectArg: any, comparisonObjectArg: any
|
||||
}
|
||||
|
||||
// lets find divergingProperties
|
||||
if (JSON.stringify(referenceObjectArg[currentProperty]) !== JSON.stringify(comparisonObjectArg[currentProperty])) {
|
||||
if (
|
||||
JSON.stringify(referenceObjectArg[currentProperty]) !==
|
||||
JSON.stringify(comparisonObjectArg[currentProperty])
|
||||
) {
|
||||
returnComparisonObject.divergingProperties.push(currentProperty);
|
||||
}
|
||||
|
||||
// lets find equalProperties
|
||||
if (JSON.stringify(referenceObjectArg[currentProperty]) === JSON.stringify(comparisonObjectArg[currentProperty])) {
|
||||
if (
|
||||
JSON.stringify(referenceObjectArg[currentProperty]) ===
|
||||
JSON.stringify(comparisonObjectArg[currentProperty])
|
||||
) {
|
||||
returnComparisonObject.equalProperties.push(currentProperty);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
// tslint:disable-next-line: no-submodule-imports
|
||||
import fastDeepEqual from 'fast-deep-equal/es6';
|
||||
|
||||
export {
|
||||
fastDeepEqual
|
||||
};
|
||||
export { fastDeepEqual };
|
||||
|
Loading…
Reference in New Issue
Block a user