Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function copyRestangularizedElement(fromElement, toElement = {}) {
const copiedElement = assign(toElement, fromElement);
return restangularizeElem(copiedElement[config.restangularFields.parentResource],
copiedElement, copiedElement[config.restangularFields.route], true);
}
static createRequestQueryParams(queryParams) {
const requestQueryParams = assign({}, queryParams);
let search: HttpParams = new HttpParams();
for (const key in requestQueryParams) {
let value: any = requestQueryParams[key];
if (Array.isArray(value)) {
value.forEach(function (val) {
search = search.append(key, val);
});
} else {
if (typeof value === 'object') {
value = JSON.stringify(value);
}
search = search.append(key, value);
}
}
static createRequestHeaders(headers) {
for (const key in headers) {
const value: any = headers[key];
if (typeof value === 'undefined') {
delete headers[key];
}
}
return new HttpHeaders(assign({}, headers));
}
}
constructor(
@Optional() @Inject(RESTANGULAR) public configObj,
private injector: Injector,
private http: RestangularHttp
) {
this.provider = new providerConfig(http);
const element = this.provider.$get();
assign(this, element);
this.setDefaultConfig();
}