This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Merge obj2: object into target: object recursivelly including array properties | |
*/ | |
function deepMerge(target, obj2) { | |
Object.keys(obj2).forEach(key => { | |
const val = obj2[key]; | |
if (!target[key]) { | |
target[key] = val; | |
} else if (Array.isArray(val)) { | |
val.forEach(item => target[key].indexOf(item) === -1 && target[key].push(item)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Makes some magic, for ex call like this | |
* api.postDonorAccount({id: 'ewqewq'}); -> leads to POST request to url: /donor/account with data: {id: '..'} | |
*/ | |
const { METHODS } = require('http'); | |
class ApiService { | |
/** | |
* Set uri of REST server | |
* @constructor |