Skip to content

Commit

Permalink
feat(router): switch ownsScope separator to noScope
Browse files Browse the repository at this point in the history
  • Loading branch information
jwx committed Aug 16, 2019
1 parent 8b32b3b commit ee79039
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/router/src/instruction-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IRouteSeparators {
viewport?: string;
sibling?: string;
scope?: string;
ownsScope?: string;
noScope?: string;
parameters?: string;
parametersEnd?: string;
parameter?: string;
Expand All @@ -27,7 +27,7 @@ export class InstructionResolver {
viewport: '@', // ':',
sibling: '+', // '/',
scope: '/', // '+',
ownsScope: '!',
noScope: '!',
parameters: '(', // '='
parametersEnd: ')', // ''
parameter: '&',
Expand Down Expand Up @@ -155,12 +155,12 @@ export class InstructionResolver {
}

private parseAViewportInstruction(instruction: string): ViewportInstruction {
let scope: boolean;
let scope: boolean = true;

// Scope is always at the end, regardless of anything else
if (instruction.endsWith(this.separators.ownsScope)) {
scope = true;
instruction = instruction.slice(0, -this.separators.ownsScope.length);
// No scope is always at the end, regardless of anything else
if (instruction.endsWith(this.separators.noScope)) {
scope = false;
instruction = instruction.slice(0, -this.separators.noScope.length);
}

const [componentPart, viewport] = instruction.split(this.separators.viewport);
Expand All @@ -187,8 +187,8 @@ export class InstructionResolver {
if (instruction.viewportName !== null && !excludeViewport) {
instructionString += this.separators.viewport + instruction.viewportName;
}
if (instruction.ownsScope) {
instructionString += this.separators.ownsScope;
if (!instruction.ownsScope) {
instructionString += this.separators.noScope;
}
return instructionString;
}
Expand Down

0 comments on commit ee79039

Please sign in to comment.