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
| function replace(template: string, replacements: string[]) { | |
| const initialState = { | |
| result: '', | |
| valid: true, | |
| openGroup: false, | |
| previous: '', | |
| index: 0, | |
| }; | |
| return template.split('').reduce((acc, next) => { |
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
| import { ChangeDetectorRef } from '@angular/core'; | |
| import { ComponentFixture } from '@angular/core/testing'; | |
| export async function runOnPushChangeDetection<T>(cf: ComponentFixture<T>) { | |
| const cd = cf.debugElement.injector.get<ChangeDetectorRef>( | |
| // tslint:disable-next-line:no-any | |
| ChangeDetectorRef as any | |
| ); | |
| cd.detectChanges(); | |
| await cf.whenStable(); |
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
| import { cloneDeep } from 'lodash'; | |
| class UrlTemplateService { | |
| private readonly urlsMap = { | |
| serviceA: { | |
| example1: (p: { customerCode: string }) => this.replace('one.parameter/${customerCode}', p), | |
| pathB: (p: { more: string, parameter: string }) => this.replace('two.more.example/${more}/${parameter}/${more}', p) | |
| }, | |
| serviceB: { |