Skip to content

Commit

Permalink
feat(router): add flattenViewportInstructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jwx committed Aug 20, 2019
1 parent 0d297e3 commit 43e15ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/router/src/instruction-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ export class InstructionResolver {
return unique;
}

public flattenViewportInstructions(instructions: ViewportInstruction[]): ViewportInstruction[] {
const flat: ViewportInstruction[] = [];
for (const instruction of instructions) {
flat.push(instruction);
if (instruction.nextScopeInstruction) {
flat.push(...this.flattenViewportInstructions([instruction.nextScopeInstruction]));
}
}
return flat;
}

public stateStringsToString(stateStrings: string[], clear: boolean = false): string {
const strings = stateStrings.slice();
if (clear) {
Expand Down

0 comments on commit 43e15ac

Please sign in to comment.