FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.resolvePath() function

string fcf.resolvePath(string a_uri, object a_aliases = undefined)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Converts a string containing an alias to a real path in FCF notation.

Paths that use aliases begin with the @ special character followed by the alias name up to delimiters ("+", "#", "?", "/", "\\").

If a string is passed that does not contain an alias, then the function returns the passed original. If the alias is not found, the function throws a fcf.Exception with the code RESOLVE_PATH_ERROR


string a_uri
- Path to a resource containing an alias

object a_aliases = undefined
- Aliases object. The alias is the key and the value is the path.
- The resulting resource path in FCF format

Example: Function application

fcf.getConfiguration().append({ aliases: { "controls:button": "fcf-framework-controls:templates/button.tmpl", } }); { let result = fcf.resolvePath("@controls:button"); console.log(result); } { let result = fcf.resolvePath("@controls:button?query-arument=1"); console.log(result); } { let result = fcf.resolvePath("@controls:textarea", {"controls:textarea": "fcf-framework-controls:templates/textarea.tmpl" }); console.log(result); }


fcf-framework-controls:templates/button.tmpl fcf-framework-controls:templates/button.tmpl?query-arument=1 fcf-framework-controls:templates/textarea.tmpl