README
Huz.Com > Component > Merger
- Merges or overrides two objects with deeply and type-concern
- It supports multi-tenancy customization structure with
$._merge.<tenant-code>
- It supports environment customization structure with
$._env.<environment>
Standards
- Language:
TS
- Eslint:
Yes
- Static Code Analysis:
Yes
IntelliJ Code Inspections - DDD - Document Driven:
Yes
- EDD - Exception Driven:
Yes
- TDD - Test Driven:
Yes
go to test folder - Standards Complied: Huz Standards
Commands
npm run clear
// clears "dist" foldernpm run lint
// runs eslint for static code analysisnpm run test
// runs test files in "test" foldernpm run build
// builds JS files at "dist" foldernpm publish
ornpm run publix
// publishes "dist" folder to npm
Install
npm i @huz-com/merger
Samples
const {merger} = require('@huz-com/merger');
// merges targetObject with sourceObject
const newObject = merger.applyNode(req, sourceObject, targetObject);
// merges tenant doc with given tenant identifiers and ignores some properties
const newDoc = merger.applyTenant(req, tenantDoc, tenantCode, tenantId, ['id', 'createdAt']);
// merges config data with given environment
const newConfig = merger.applyEnvironment(req, tenantDoc, 'prod');