Revert "fix(router): make routerLinkActive work with query params which contain arrays (#22666)" (#33861)

This reverts commit b30bb8dd91.

Reason: breaks internal g3 project.

PR Close #33861
This commit is contained in:
Alex Rickabaugh
2019-11-15 12:45:37 -08:00
parent c182dea146
commit 3074cdfea9
4 changed files with 6 additions and 48 deletions

View File

@ -10,7 +10,7 @@ import {NgModuleFactory, ɵisObservable as isObservable, ɵisPromise as isPromis
import {Observable, from, of } from 'rxjs';
import {concatAll, last as lastValue, map} from 'rxjs/operators';
import {PRIMARY_OUTLET, Params} from '../shared';
import {PRIMARY_OUTLET} from '../shared';
export function shallowEqualArrays(a: any[], b: any[]): boolean {
if (a.length !== b.length) return false;
@ -20,7 +20,7 @@ export function shallowEqualArrays(a: any[], b: any[]): boolean {
return true;
}
export function shallowEqual(a: Params, b: Params): boolean {
export function shallowEqual(a: {[x: string]: any}, b: {[x: string]: any}): boolean {
// Casting Object.keys return values to include `undefined` as there are some cases
// in IE 11 where this can happen. Cannot provide a test because the behavior only
// exists in certain circumstances in IE 11, therefore doing this cast ensures the
@ -33,25 +33,13 @@ export function shallowEqual(a: Params, b: Params): boolean {
let key: string;
for (let i = 0; i < k1.length; i++) {
key = k1[i];
if (!equalArraysOrString(a[key], b[key])) {
if (a[key] !== b[key]) {
return false;
}
}
return true;
}
/**
* Test equality for arrays of strings or a string.
*/
export function equalArraysOrString(a: string | string[], b: string | string[]) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length != b.length) return false;
return a.every(aItem => b.indexOf(aItem) > -1);
} else {
return a === b;
}
}
/**
* Flattens single-level nested arrays.
*/