refactor: move all utility functions into the utils dir
This commit is contained in:
parent
013f9a2bbc
commit
c9b4bcf689
|
@ -1,11 +1,10 @@
|
||||||
import { UrlTree, UrlSegment, equalUrlSegments } from './url_tree';
|
import { UrlTree, UrlSegment, equalUrlSegments } from './url_tree';
|
||||||
import { shallowEqual, flatten, first, merge } from './util';
|
import { shallowEqual, flatten, first, merge } from './utils/collection';
|
||||||
import { TreeNode, rootNode } from './tree';
|
import { TreeNode, rootNode } from './utils/tree';
|
||||||
import { RouterState, ActivatedRoute, Params, PRIMARY_OUTLET } from './router_state';
|
import { RouterState, ActivatedRoute, Params, PRIMARY_OUTLET } from './router_state';
|
||||||
import { RouterConfig, Route } from './config';
|
import { RouterConfig, Route } from './config';
|
||||||
import { ComponentResolver, ComponentFactory, Type } from '@angular/core';
|
import { ComponentResolver, ComponentFactory, Type } from '@angular/core';
|
||||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
import { Observer } from 'rxjs/Observer';
|
|
||||||
|
|
||||||
export function recognize(componentResolver: ComponentResolver, config: RouterConfig,
|
export function recognize(componentResolver: ComponentResolver, config: RouterConfig,
|
||||||
url: UrlTree, existingState: RouterState): Promise<RouterState> {
|
url: UrlTree, existingState: RouterState): Promise<RouterState> {
|
||||||
|
|
|
@ -3,12 +3,12 @@ import { Location } from '@angular/common';
|
||||||
import { UrlSerializer } from './url_serializer';
|
import { UrlSerializer } from './url_serializer';
|
||||||
import { RouterOutletMap } from './router_outlet_map';
|
import { RouterOutletMap } from './router_outlet_map';
|
||||||
import { recognize } from './recognize';
|
import { recognize } from './recognize';
|
||||||
import { rootNode, TreeNode } from './tree';
|
import { rootNode, TreeNode } from './utils/tree';
|
||||||
import { UrlTree } from './url_tree';
|
import { UrlTree } from './url_tree';
|
||||||
import { createEmptyState, RouterState, ActivatedRoute, PRIMARY_OUTLET } from './router_state';
|
import { createEmptyState, RouterState, ActivatedRoute, PRIMARY_OUTLET } from './router_state';
|
||||||
import { RouterConfig } from './config';
|
import { RouterConfig } from './config';
|
||||||
import { RouterOutlet } from './directives/router_outlet';
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
import { forEach } from './util';
|
import { forEach } from './utils/collection';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Tree, TreeNode } from './tree';
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
import { UrlSegment } from './url_tree';
|
import { UrlSegment } from './url_tree';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { UrlTree, UrlSegment } from './url_tree';
|
import { UrlTree, UrlSegment } from './url_tree';
|
||||||
import { rootNode, TreeNode } from './tree';
|
import { rootNode, TreeNode } from './utils/tree';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a way to serialize/deserialize a url tree.
|
* Defines a way to serialize/deserialize a url tree.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Tree, TreeNode } from './tree';
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
import { shallowEqual } from './util';
|
import { shallowEqual } from './utils/collection';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A URL in the tree form.
|
* A URL in the tree form.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Tree, TreeNode} from '../src/tree';
|
import {Tree, TreeNode} from '../../src/utils/tree';
|
||||||
|
|
||||||
describe('tree', () => {
|
describe('tree', () => {
|
||||||
it("should return the root of the tree", () => {
|
it("should return the root of the tree", () => {
|
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"src/router.ts",
|
"src/router.ts",
|
||||||
"test/tree.spec.ts",
|
"test/utils/tree.spec.ts",
|
||||||
"test/url_serializer.spec.ts",
|
"test/url_serializer.spec.ts",
|
||||||
"test/recognize.spec.ts",
|
"test/recognize.spec.ts",
|
||||||
"test/router.spec.ts",
|
"test/router.spec.ts",
|
||||||
|
|
Loading…
Reference in New Issue