This class contains functions which convert TargetStates, Nodes and paths from one type to another.

### Hierarchy

- PathUtils

## Index

### Methods

- applyViewConfigs
- buildPath
- buildToPath
- equals
- inheritParams
- makeTargetState
- matching
- nonDynamicParams
- paramValues
- subPath
- treeChanges

## Methods

- applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]): void

- Creates ViewConfig objects and adds to nodes.

- Creates ViewConfig objects and adds to nodes.

  On each PathNode, creates ViewConfig objects from the views: property of the node's state

  #### Parameters

  - ##### $view ViewService

  - ##### path PathNode[]

  - ##### states StateObject[]

  #### Returns void

  - Defined in path/pathUtils.ts:49

- buildPath(targetState: TargetState): PathNode[]

- #### Parameters

  - ##### targetState TargetState

  #### Returns PathNode[]

  - Defined in path/pathUtils.ts:30

- buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[]

- Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[]

- Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[]

  #### Parameters

  - ##### fromPath PathNode[]

  - ##### targetState TargetState

  #### Returns PathNode[]

  - Defined in path/pathUtils.ts:36

- equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean

- Returns true if two paths are identical.

- Returns true if two paths are identical.

  #### Parameters

  - ##### pathA PathNode[]

    :

  - ##### pathB PathNode[]

    :

  - ##### paramsFn: Optional GetParamsFn

    :

    a function which returns the parameters to consider when comparing

  #### Returns boolean

  :

  true if the the states and parameter values for both paths are identical

  - Defined in path/pathUtils.ts:172

- inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys?: string[]): PathNode[]

- Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath

- Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath

  For a parameter in a node to be inherited from the from path:

  - The toPath's node must have a matching node in the fromPath (by state).
  - The parameter name must not be found in the toKeys parameter array.

  Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, it is not inherited from the fromPath.

  #### Parameters

  - ##### fromPath PathNode[]

  - ##### toPath PathNode[]

  - ##### toKeys: Default value string[] = []

  #### Returns PathNode[]

  - Defined in path/pathUtils.ts:70

- makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState

- Given a PathNode[], create an TargetState

- Given a PathNode[], create an TargetState

  #### Parameters

  - ##### registry StateRegistry

  - ##### path PathNode[]

  #### Returns TargetState

  - Defined in path/pathUtils.ts:25

- matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[]

- Returns a new path which is: the subpath of the first path which matches the second path.

- Returns a new path which is: the subpath of the first path which matches the second path.

  The new path starts from root and contains any nodes that match the nodes in the second path. It stops before the first non-matching node.

  Nodes are compared using their state property and their parameter values. If a `paramsFn` is provided, only the Param returned by the function will be considered when comparing nodes.

  #### Parameters

  - ##### pathA PathNode[]

    :

    the first path

  - ##### pathB PathNode[]

    :

    the second path

  - ##### paramsFn: Optional GetParamsFn

    :

    a function which returns the parameters to consider when comparing

  #### Returns PathNode[]

  :

  an array of PathNodes from the first path which match the nodes in the second path

  - Defined in path/pathUtils.ts:155

- nonDynamicParams(node: PathNode): Param[]

- #### Parameters

  - ##### node PathNode

  #### Returns Param[]

  - Defined in path/pathUtils.ts:101

- paramValues(path: PathNode[]): object

- Gets the raw parameter values from a path

- Gets the raw parameter values from a path

  #### Parameters

  - ##### path PathNode[]

  #### Returns object

  - Defined in path/pathUtils.ts:194

- subPath(path: PathNode[], predicate: Predicate<PathNode>): PathNode[]

- Return a subpath of a path, which stops at the first matching node

- Return a subpath of a path, which stops at the first matching node

  Given an array of nodes, returns a subset of the array starting from the first node, stopping when the first node matches the predicate.

  #### Parameters

  - ##### path PathNode[]

    :

    a path of PathNodes

  - ##### predicate Predicate<PathNode>

    :

    a Predicate fn that matches PathNodes

  #### Returns PathNode[]

  :

  a subpath up to the matching node, or undefined if no match is found

  - Defined in path/pathUtils.ts:187

- treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges

- Computes the tree changes (entering, exiting) between a fromPath and toPath.

- Computes the tree changes (entering, exiting) between a fromPath and toPath.

  #### Parameters

  - ##### fromPath PathNode[]

  - ##### toPath PathNode[]

  - ##### reloadState StateObject

  #### Returns TreeChanges

  - Defined in path/pathUtils.ts:108

Generated using TypeDoc