chore(typings): restrict Angular to es5+collections+promise

This commit is contained in:
Alex Eagle
2016-06-24 15:37:46 -07:00
parent d20488752b
commit e913d9954d
5 changed files with 81 additions and 14 deletions

View File

@ -214,14 +214,15 @@ function findPosParam(
}
function findOrCreatePath(part: string, paths: UrlPathWithParams[]): UrlPathWithParams {
const matchingIndex = paths.findIndex(s => s.path === part);
if (matchingIndex > -1) {
const r = paths[matchingIndex];
paths.splice(matchingIndex);
return r;
} else {
return new UrlPathWithParams(part, {});
let idx = 0;
for (const s of paths) {
if (s.path === part) {
paths.splice(idx);
return s;
}
idx++;
}
return new UrlPathWithParams(part, {});
}

View File

@ -37,13 +37,12 @@ function createNode(curr: TreeNode<ActivatedRouteSnapshot>, prevState?: TreeNode
function createOrReuseChildren(
curr: TreeNode<ActivatedRouteSnapshot>, prevState: TreeNode<ActivatedRoute>) {
return curr.children.map(child => {
const index =
prevState.children.findIndex(p => equalRouteSnapshots(p.value.snapshot, child.value));
if (index >= 0) {
return createNode(child, prevState.children[index]);
} else {
return createNode(child);
for (const p of prevState.children) {
if (equalRouteSnapshots(p.value.snapshot, child.value)) {
return createNode(child, p);
}
}
return createNode(child);
});
}