1.0.1 • Published 5 years ago
@huz-com/merger v1.0.1
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:
YesIntelliJ Code Inspections - DDD - Document Driven:
Yes - EDD - Exception Driven:
Yes - TDD - Test Driven:
Yesgo 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 publishornpm 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');1.0.1
5 years ago